From 9920a51ff5a5c6914f5bc72ce60c22245d5f1352 Mon Sep 17 00:00:00 2001
From: unknown <8n-tech@users.noreply.github.com>
Date: Fri, 17 Oct 2014 02:32:39 -0500
Subject: [PATCH 01/12] - Resolved board creation script throwing SQL error for
mismatched column count. - Resolved warnings would be thrown if
inc/dnsbls.php did not exist. - Resolved problem where shell_exec_error was
incorrectly reporting a success in instances where 'md5sum' was not
supported, resulting in "'md5sum'" literally being recorded as the file hash.
This then lead to hex2bin throwing an error on page load, preventing access
to threads (among other problems).
---
inc/functions.php | 40 +++--
inc/instance-config.php | 389 +---------------------------------------
inc/mod/pages.php | 2 +-
post.php | 19 +-
4 files changed, 51 insertions(+), 399 deletions(-)
diff --git a/inc/functions.php b/inc/functions.php
index b61f5bb7..963a1e74 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -894,10 +894,14 @@ function insertFloodPost(array $post) {
$query->bindValue(':board', $board['uri']);
$query->bindValue(':time', time());
$query->bindValue(':posthash', make_comment_hex($post['body_nomarkup']));
- if ($post['has_file'])
+
+ if ($post['has_file']) {
$query->bindValue(':filehash', $post['filehash']);
- else
+ }
+ else {
$query->bindValue(':filehash', null, PDO::PARAM_NULL);
+ }
+
$query->bindValue(':isreply', !$post['op'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
}
@@ -2318,24 +2322,38 @@ function DNS($host) {
function shell_exec_error($command, $suppress_stdout = false) {
global $config, $debug;
-
- if ($config['debug'])
+
+ if( $config['debug'] ) {
+ $which = microtime(true);
+ }
+
+ // Determine if $command is a valid command. If we don't, the following is considered valid output.
+ // '$command' is not recognized as an internal or external command, operable program or batch file.
+ if( empty( shell_exec("which $command") ) ) {
+ return false;
+ }
+
+ if( $config['debug'] ) {
$start = microtime(true);
-
+ }
+
+
$return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' .
$command . ' 2>&1 ' . ($suppress_stdout ? '> /dev/null ' : '') . '&& echo "TB_SUCCESS"'));
$return = preg_replace('/TB_SUCCESS$/', '', $return);
-
- if ($config['debug']) {
- $time = microtime(true) - $start;
+
+ if( $config['debug'] ) {
+ $time_which = $start - $which;
+ $time = microtime(true) - $start;
+
$debug['exec'][] = array(
- 'command' => $command,
- 'time' => '~' . round($time * 1000, 2) . 'ms',
+ 'command' => $command,
+ 'time' => '~' . round($time * 1000, 2) . 'ms + ~' . round($time_which * 1000, 2) . 'ms',
'response' => $return ? $return : null
);
$debug['time']['exec'] += $time;
}
-
+
return $return === 'TB_SUCCESS' ? false : $return;
}
diff --git a/inc/instance-config.php b/inc/instance-config.php
index 699d1a18..db80c4c1 100644
--- a/inc/instance-config.php
+++ b/inc/instance-config.php
@@ -7,31 +7,25 @@
*
* You can copy values from config.php (defaults) and paste them here.
*/
- require_once "lib/htmlpurifier-4.5.0/library/HTMLPurifier.auto.php";
- require_once "8chan-functions.php";
- // Note - you may want to change some of these in secrets.php instead of here
- // See the secrets.example.php file
- $config['db']['server'] = 'localhost';
- $config['db']['database'] = '8chan';
+
+ $config['db']['server'] = '127.0.0.1:3307';
+ $config['db']['database'] = 'chan';
$config['db']['prefix'] = '';
- $config['db']['user'] = 'root';
+ $config['db']['user'] = 'chan';
$config['db']['password'] = '';
- $config['timezone'] = 'UTC';
- $config['cache']['enabled'] = 'apc';
$config['cookies']['mod'] = 'mod';
- $config['cookies']['salt'] = '';
-
- $config['spam']['hidden_inputs_max_pass'] = 128;
- $config['spam']['hidden_inputs_expire'] = 60 * 60 * 4; // three hours
+ $config['cookies']['salt'] = 'OTRkMWRlYmRlZmE2NGZkNmU5YThkZW';
$config['flood_time'] = 5;
$config['flood_time_ip'] = 30;
$config['flood_time_same'] = 2;
$config['max_body'] = 5000;
$config['reply_limit'] = 300;
+ $config['max_links'] = 40;
+ $config['max_filesize'] = 8388608;
$config['thumb_width'] = 255;
$config['thumb_height'] = 255;
$config['max_width'] = 10000;
@@ -39,371 +33,6 @@
$config['threads_per_page'] = 15;
$config['max_pages'] = 15;
$config['threads_preview'] = 5;
- $config['root'] = '/';
- $config['secure_trip_salt'] = '';
- $config['always_noko'] = true;
- $config['allow_no_country'] = true;
- $config['thread_subject_in_title'] = true;
- $config['spam']['hidden_inputs_max_pass'] = 128;
- $config['ayah_enabled'] = true;
+ $config['root'] = '/8chan/';
+ $config['secure_trip_salt'] = 'ZjJmMzg1MzY4MWU3Y2UyNzkxYmQyNW';
- // Load database credentials
- require "secrets.php";
-
- // Image shit
- $config['thumb_method'] = 'gm+gifsicle';
- $config['thumb_ext'] = '';
- $config['thumb_keep_animation_frames'] = 100;
- $config['show_ratio'] = true;
- //$config['allow_upload_by_url'] = true;
- $config['max_filesize'] = 1024 * 1024 * 8; // 8MB
- $config['disable_images'] = false;
- $config['spoiler_images'] = true;
- $config['image_reject_repost'] = true;
- $config['allowed_ext_files'][] = 'webm';
- $config['webm']['use_ffmpeg'] = true;
- $config['webm']['allow_audio'] = true;
- $config['webm']['max_length'] = 60 * 15;
-
- // Mod shit
- $config['mod']['groups'][25] = 'Supermod';
- define_groups();
- $config['mod']['capcode'][MOD] = array('Board Volunteer');
- $config['mod']['capcode'][SUPERMOD] = array('Global Volunteer');
- $config['custom_capcode']['Admin'] = array(
- ' %s ',
- );
- $config['custom_capcode']['Bear'] = array(
- ' %s ',
- );
- //$config['mod']['view_banlist'] = SUPERMOD;
- $config['mod']['show_ip'] = SUPERMOD;
- $config['mod']['show_ip_less'] = MOD;
- $config['mod']['manageusers'] = SUPERMOD;
- $config['mod']['noticeboard_post'] = SUPERMOD;
- $config['mod']['search'] = SUPERMOD;
- $config['mod']['debug_recent'] = ADMIN;
- $config['mod']['debug_antispam'] = ADMIN;
- $config['mod']['modlog'] = SUPERMOD;
- $config['mod']['editpost'] = MOD;
- $config['mod']['recent_reports'] = 65535;
- $config['ban_show_post'] = true;
-
- // Board shit
- $config['max_links'] = 40;
- $config['poster_id_length'] = 6;
- $config['ayah_enabled'] = true;
- $config['url_banner'] = '/banners.php';
- //$config['default_stylesheet'] = array('Notsuba', 'notsuba.css');
- $config['additional_javascript'][] = 'js/jquery.min.js';
- $config['additional_javascript'][] = 'js/jquery.tablesorter.min.js';
- $config['additional_javascript'][] = 'js/options.js';
- $config['additional_javascript'][] = 'js/style-select.js';
- $config['additional_javascript'][] = 'js/options/general.js';
- $config['additional_javascript'][] = 'js/post-hover.js';
- $config['additional_javascript'][] = 'js/update_boards.js';
- $config['additional_javascript'][] = 'js/favorites.js';
- $config['additional_javascript'][] = 'js/show-op.js';
- $config['additional_javascript'][] = 'js/hide-threads.js';
- $config['additional_javascript'][] = 'js/smartphone-spoiler.js';
- $config['additional_javascript'][] = 'js/inline-expanding.js';
- $config['additional_javascript'][] = 'js/show-backlinks.js';
- $config['additional_javascript'][] = 'js/webm-settings.js';
- $config['additional_javascript'][] = 'js/expand-video.js';
- $config['additional_javascript'][] = 'js/treeview.js';
- $config['additional_javascript'][] = 'js/quick-post-controls.js';
- $config['additional_javascript'][] = 'js/expand-too-long.js';
- $config['additional_javascript'][] = 'js/settings.js';
- $config['additional_javascript'][] = 'js/fix-report-delete-submit.js';
- $config['additional_javascript'][] = 'js/hide-images.js';
- $config['additional_javascript'][] = 'js/expand-all-images.js';
- $config['additional_javascript'][] = 'js/local-time.js';
- $config['additional_javascript'][] = 'js/no-animated-gif.js';
- $config['additional_javascript'][] = 'js/expand.js';
- $config['additional_javascript'][] = 'js/titlebar-notifications.js';
- $config['additional_javascript'][] = 'js/auto-reload.js';
- $config['additional_javascript'][] = 'js/quick-reply.js';
- $config['additional_javascript'][] = 'js/options/user-css.js';
- $config['additional_javascript'][] = 'js/options/user-js.js';
- $config['additional_javascript'][] = 'js/forced-anon.js';
- $config['additional_javascript'][] = 'js/toggle-locked-threads.js';
- $config['additional_javascript'][] = 'js/toggle-images.js';
- $config['additional_javascript'][] = 'js/mobile-style.js';
- $config['additional_javascript'][] = 'js/id_highlighter.js';
- $config['additional_javascript'][] = 'js/id_colors.js';
- $config['additional_javascript'][] = 'js/inline.js';
- $config['additional_javascript'][] = 'js/infinite-scroll.js';
- $config['additional_javascript'][] = 'js/download-original.js';
- $config['additional_javascript'][] = 'js/thread-watcher.js';
-
- //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
-
- $config['stylesheets']['Dark'] = 'dark.css';
- $config['stylesheets']['Photon'] = 'photon.css';
-
- $config['stylesheets_board'] = true;
- $config['markup'][] = array("/^[ |\t]*==(.+?)==[ |\t]*$/m", "\$1 ");
- $config['markup'][] = array("/\[spoiler\](.+?)\[\/spoiler\]/", "\$1 ");
- $config['markup'][] = array("/~~(.+?)~~/", "\$1 ");
-
- $config['boards'] = array(array(' ' => '/', ' ' => '/boards.html', ' ' => '/faq.html', ' ' => '/random.php', ' ' => '/create.php', ' ' => '/bans.html', ' ' => '/search.php', ' ' => '/mod.php', ' ' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array(''=>'https://twitter.com/infinitechan'));
- //$config['boards'] = array(array(' ' => '/', ' ' => '/boards.html', ' ' => '/faq.html', ' ' => '/random.php', ' ' => '/create.php', ' ' => '/search.php', ' ' => '/mod.php', ' ' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('v', 'a', 'tg', 'fit', 'pol', 'tech', 'mu', 'co', 'sp', 'boards'), array(''=>'https://twitter.com/infinitechan'));
-
- $config['footer'][] = 'Contribute to 8chan.co development at github ';
- $config['footer'][] = 'To make a DMCA request or report illegal content, please email admin@8chan.co or use the "Global Report" functionality on every page.';
-
- $config['search']['enable'] = true;
-
-//$config['debug'] = true;
- $config['syslog'] = true;
-
- $config['wordfilters'][] = array('\rule', ''); // 'true' means it's a regular expression
-
- if (!function_exists('prettify_textarea')){
- function prettify_textarea($s){
- return str_replace("\t", ' ', str_replace("\n", '
', htmlentities($s)));
- }
- }
-
- if (!function_exists('purify')){
- function purify($s){
- $config = HTMLPurifier_Config::createDefault();
- $purifier = new HTMLPurifier($config);
- $clean_html = $purifier->purify($s);
- return $clean_html;
- }
- }
-
- $config['mod']['custom_pages']['/banners/(\%b)'] = function($b) {
- global $config, $mod, $board;
- require_once 'inc/image.php';
-
- if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*')
- error($config['error']['noaccess']);
-
- if (!openBoard($b))
- error("Could not open board!");
-
- $dir = 'static/banners/'.$b;
-
- if (!is_dir($dir)){
- mkdir($dir, 0777, true);
- }
-
-
- if (isset($_FILES['file'])){
- $upload = $_FILES['file']['tmp_name'];
- $banners = array_diff(scandir($dir), array('..', '.'));
-
- if (!is_readable($upload))
- error($config['error']['nomove']);
-
- $id = time() . substr(microtime(), 2, 3);
- $extension = strtolower(mb_substr($_FILES['file']['name'], mb_strrpos($_FILES['file']['name'], '.') + 1));
-
- if (!in_array($extension, array('jpg','jpeg','png','gif'))){
- error('Not an image extension.');
- }
-
- if (filesize($upload) > 512000){
- error('File too large!');
- }
-
- if (!$size = @getimagesize($upload)) {
- error($config['error']['invalidimg']);
- }
-
- if ($size[0] != 300 or $size[1] != 100){
- error('Image wrong size!');
- }
- if (sizeof($banners) >= 50) {
- error('Too many banners.');
- }
-
- copy($upload, "$dir/$id.$extension");
- }
-
- if (isset($_POST['delete'])){
- foreach ($_POST['delete'] as $i => $d){
- if (!preg_match('/[0-9+]\.(png|jpeg|jpg|gif)/', $d)){
- error('Nice try.');
- }
- unlink("$dir/$d");
- }
- }
-
- $banners = array_diff(scandir($dir), array('..', '.'));
- mod_page(_('Edit banners'), 'mod/banners.html', array('board'=>$board,'banners'=>$banners,'token'=>make_secure_link_token('banners/'.$board['uri'])));
-
- };
-
- $config['mod']['custom_pages']['/settings/(\%b)'] = function($b) {
- global $config, $mod;
-
- if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*')
- error($config['error']['noaccess']);
-
- if (!openBoard($b))
- error("Could not open board!");
-
- $possible_languages = array_diff(scandir('inc/locale/'), array('..', '.', '.tx', 'README.md'));
-
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $title = $_POST['title'];
- $subtitle = $_POST['subtitle'];
- $country_flags = isset($_POST['country_flags']) ? 'true' : 'false';
- $field_disable_name = isset($_POST['field_disable_name']) ? 'true' : 'false';
- $enable_embedding = isset($_POST['enable_embedding']) ? 'true' : 'false';
- $force_image_op = isset($_POST['force_image_op']) ? 'true' : 'false';
- $disable_images = isset($_POST['disable_images']) ? 'true' : 'false';
- $poster_ids = isset($_POST['poster_ids']) ? 'true' : 'false';
- $show_sages = isset($_POST['show_sages']) ? 'true' : 'false';
- $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
- $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
- $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
- $allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
- $code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\[code\](.+?)\[\/code\]/ms", "\$1
");' : '';
- $katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\[tex\](.+?)\[\/tex\]/ms", "\$1 "); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : '';
-$oekaki_js = << $r ) {
- if ($r !== '') {
- $w = $_POST['with'][$i];
- $replace .= '$config[\'wordfilters\'][] = array(base64_decode(\'' . base64_encode($r) . '\'), base64_decode(\'' . base64_encode($w) . '\'));';
- }
- }
- }
- }
-
- if (!(strlen($title) < 40))
- error('Invalid title');
- if (!(strlen($subtitle) < 200))
- error('Invalid subtitle');
-
- $query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle, `indexed` = :indexed, `public_bans` = :public_bans WHERE `uri` = :uri');
- $query->bindValue(':title', $title);
- $query->bindValue(':subtitle', $subtitle);
- $query->bindValue(':uri', $b);
- $query->bindValue(':indexed', !isset($_POST['meta_noindex']));
- $query->bindValue(':public_bans', isset($_POST['public_bans']));
- $query->execute() or error(db_error($query));
-
-
- $config_file = <<'Rules', 'subtitle'=>'', 'config'=>$config, 'body'=>''.purify($_POST['rules']).'
')));
- file_write($b.'/rules.txt', $_POST['rules']);
- openBoard($b);
- buildIndex();
- buildJavascript();
- $query = query(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL", $b)) or error(db_error());
- while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
- buildThread($post['id']);
- }
- modLog('Edited board settings', $b);
- }
-
- $query = prepare('SELECT * FROM boards WHERE uri = :board');
- $query->bindValue(':board', $b);
- $query->execute() or error(db_error($query));
- $board = $query->fetchAll()[0];
-
- $rules = @file_get_contents($board['uri'] . '/rules.txt');
- $css = @file_get_contents('stylesheets/board/' . $board['uri'] . '.css');
-
- openBoard($b);
-
- rebuildThemes('bans');
-
- if ($config['cache']['enabled'])
- cache::delete('board_' . $board['uri']);
- cache::delete('all_boards');
-
- mod_page(_('Board configuration'), 'mod/settings.html', array('board'=>$board, 'rules'=>prettify_textarea($rules), 'css'=>prettify_textarea($css), 'token'=>make_secure_link_token('settings/'.$board['uri']), 'languages'=>$possible_languages));
- };
- $config['embedding'] = array(
- array(
- '/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
- 'VIDEO '
- ),
- array(
- '/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
- ' '
- ),
- array(
- '/^https?:\/\/(\w+\.)?dailymotion\.com\/video\/([a-zA-Z0-9]{2,10})(_.+)?$/i',
- ' '
- ),
- array(
- '/^https?:\/\/(\w+\.)?metacafe\.com\/watch\/(\d+)\/([a-zA-Z0-9_\-.]+)\/(\?.+)?$/i',
- '
'
- ),
- array(
- '/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([](.+)?)?$/i',
- ' '
- ),
- array(
- '/^https?:\/\/(\w+\.)?vocaroo\.com\/i\/([a-zA-Z0-9]{2,15})$/i',
- ' '
- )
- );
-
-$config['gzip_static'] = false;
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 3cdf1374..52b831aa 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -496,7 +496,7 @@ function mod_new_board() {
error(sprintf($config['error']['boardexists'], $board['url']));
}
- $query = prepare('INSERT INTO ``boards`` VALUES (:uri, :title, :subtitle)');
+ $query = prepare('INSERT INTO ``boards`` (``uri``, ``title``, ``subtitle``) VALUES (:uri, :title, :subtitle)');
$query->bindValue(':uri', $_POST['uri']);
$query->bindValue(':title', $_POST['title']);
$query->bindValue(':subtitle', $_POST['subtitle']);
diff --git a/post.php b/post.php
index 40f71555..0781d128 100644
--- a/post.php
+++ b/post.php
@@ -2,10 +2,13 @@
/*
* Copyright (c) 2010-2014 Tinyboard Development Group
*/
+
+require "./inc/functions.php";
+require "./inc/anti-bot.php";
-require 'inc/functions.php';
-require 'inc/anti-bot.php';
-include "inc/dnsbls.php";
+// The dnsbls is an optional DNS blacklist include.
+// Squelch warnings if it doesn't exist.
+@include "./inc/dnsbls.php";
// Fix for magic quotes
if (get_magic_quotes_gpc()) {
@@ -573,14 +576,16 @@ if (isset($_POST['delete'])) {
}
$md5cmd = $config['bsd_md5'] ? 'md5 -r' : 'md5sum';
-
- if ($output = shell_exec_error("cat $filenames | $md5cmd")) {
+
+ if( ($output = shell_exec_error("cat $filenames | $md5cmd")) !== false ) {
$explodedvar = explode(' ', $output);
$hash = $explodedvar[0];
$post['filehash'] = $hash;
- } elseif ($config['max_images'] === 1) {
+ }
+ elseif ($config['max_images'] === 1) {
$post['filehash'] = md5_file($upload);
- } else {
+ }
+ else {
$str_to_hash = '';
foreach (explode(' ', $filenames) as $i => $f) {
$str_to_hash .= file_get_contents($f);
From ba0a874b2713c66526e7802aabf125576a284c9f Mon Sep 17 00:00:00 2001
From: unknown <8n-tech@users.noreply.github.com>
Date: Sat, 18 Oct 2014 03:32:00 -0500
Subject: [PATCH 02/12] [#184] Added tag classes. Style selector now
adds a class. Moved board list under moderator dashboard.
---
inc/instance-config.php | 389 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 380 insertions(+), 9 deletions(-)
diff --git a/inc/instance-config.php b/inc/instance-config.php
index db80c4c1..699d1a18 100644
--- a/inc/instance-config.php
+++ b/inc/instance-config.php
@@ -7,25 +7,31 @@
*
* You can copy values from config.php (defaults) and paste them here.
*/
+ require_once "lib/htmlpurifier-4.5.0/library/HTMLPurifier.auto.php";
+ require_once "8chan-functions.php";
-
- $config['db']['server'] = '127.0.0.1:3307';
- $config['db']['database'] = 'chan';
+ // Note - you may want to change some of these in secrets.php instead of here
+ // See the secrets.example.php file
+ $config['db']['server'] = 'localhost';
+ $config['db']['database'] = '8chan';
$config['db']['prefix'] = '';
- $config['db']['user'] = 'chan';
+ $config['db']['user'] = 'root';
$config['db']['password'] = '';
+ $config['timezone'] = 'UTC';
+ $config['cache']['enabled'] = 'apc';
$config['cookies']['mod'] = 'mod';
- $config['cookies']['salt'] = 'OTRkMWRlYmRlZmE2NGZkNmU5YThkZW';
+ $config['cookies']['salt'] = '';
+
+ $config['spam']['hidden_inputs_max_pass'] = 128;
+ $config['spam']['hidden_inputs_expire'] = 60 * 60 * 4; // three hours
$config['flood_time'] = 5;
$config['flood_time_ip'] = 30;
$config['flood_time_same'] = 2;
$config['max_body'] = 5000;
$config['reply_limit'] = 300;
- $config['max_links'] = 40;
- $config['max_filesize'] = 8388608;
$config['thumb_width'] = 255;
$config['thumb_height'] = 255;
$config['max_width'] = 10000;
@@ -33,6 +39,371 @@
$config['threads_per_page'] = 15;
$config['max_pages'] = 15;
$config['threads_preview'] = 5;
- $config['root'] = '/8chan/';
- $config['secure_trip_salt'] = 'ZjJmMzg1MzY4MWU3Y2UyNzkxYmQyNW';
+ $config['root'] = '/';
+ $config['secure_trip_salt'] = '';
+ $config['always_noko'] = true;
+ $config['allow_no_country'] = true;
+ $config['thread_subject_in_title'] = true;
+ $config['spam']['hidden_inputs_max_pass'] = 128;
+ $config['ayah_enabled'] = true;
+ // Load database credentials
+ require "secrets.php";
+
+ // Image shit
+ $config['thumb_method'] = 'gm+gifsicle';
+ $config['thumb_ext'] = '';
+ $config['thumb_keep_animation_frames'] = 100;
+ $config['show_ratio'] = true;
+ //$config['allow_upload_by_url'] = true;
+ $config['max_filesize'] = 1024 * 1024 * 8; // 8MB
+ $config['disable_images'] = false;
+ $config['spoiler_images'] = true;
+ $config['image_reject_repost'] = true;
+ $config['allowed_ext_files'][] = 'webm';
+ $config['webm']['use_ffmpeg'] = true;
+ $config['webm']['allow_audio'] = true;
+ $config['webm']['max_length'] = 60 * 15;
+
+ // Mod shit
+ $config['mod']['groups'][25] = 'Supermod';
+ define_groups();
+ $config['mod']['capcode'][MOD] = array('Board Volunteer');
+ $config['mod']['capcode'][SUPERMOD] = array('Global Volunteer');
+ $config['custom_capcode']['Admin'] = array(
+ ' %s ',
+ );
+ $config['custom_capcode']['Bear'] = array(
+ ' %s ',
+ );
+ //$config['mod']['view_banlist'] = SUPERMOD;
+ $config['mod']['show_ip'] = SUPERMOD;
+ $config['mod']['show_ip_less'] = MOD;
+ $config['mod']['manageusers'] = SUPERMOD;
+ $config['mod']['noticeboard_post'] = SUPERMOD;
+ $config['mod']['search'] = SUPERMOD;
+ $config['mod']['debug_recent'] = ADMIN;
+ $config['mod']['debug_antispam'] = ADMIN;
+ $config['mod']['modlog'] = SUPERMOD;
+ $config['mod']['editpost'] = MOD;
+ $config['mod']['recent_reports'] = 65535;
+ $config['ban_show_post'] = true;
+
+ // Board shit
+ $config['max_links'] = 40;
+ $config['poster_id_length'] = 6;
+ $config['ayah_enabled'] = true;
+ $config['url_banner'] = '/banners.php';
+ //$config['default_stylesheet'] = array('Notsuba', 'notsuba.css');
+ $config['additional_javascript'][] = 'js/jquery.min.js';
+ $config['additional_javascript'][] = 'js/jquery.tablesorter.min.js';
+ $config['additional_javascript'][] = 'js/options.js';
+ $config['additional_javascript'][] = 'js/style-select.js';
+ $config['additional_javascript'][] = 'js/options/general.js';
+ $config['additional_javascript'][] = 'js/post-hover.js';
+ $config['additional_javascript'][] = 'js/update_boards.js';
+ $config['additional_javascript'][] = 'js/favorites.js';
+ $config['additional_javascript'][] = 'js/show-op.js';
+ $config['additional_javascript'][] = 'js/hide-threads.js';
+ $config['additional_javascript'][] = 'js/smartphone-spoiler.js';
+ $config['additional_javascript'][] = 'js/inline-expanding.js';
+ $config['additional_javascript'][] = 'js/show-backlinks.js';
+ $config['additional_javascript'][] = 'js/webm-settings.js';
+ $config['additional_javascript'][] = 'js/expand-video.js';
+ $config['additional_javascript'][] = 'js/treeview.js';
+ $config['additional_javascript'][] = 'js/quick-post-controls.js';
+ $config['additional_javascript'][] = 'js/expand-too-long.js';
+ $config['additional_javascript'][] = 'js/settings.js';
+ $config['additional_javascript'][] = 'js/fix-report-delete-submit.js';
+ $config['additional_javascript'][] = 'js/hide-images.js';
+ $config['additional_javascript'][] = 'js/expand-all-images.js';
+ $config['additional_javascript'][] = 'js/local-time.js';
+ $config['additional_javascript'][] = 'js/no-animated-gif.js';
+ $config['additional_javascript'][] = 'js/expand.js';
+ $config['additional_javascript'][] = 'js/titlebar-notifications.js';
+ $config['additional_javascript'][] = 'js/auto-reload.js';
+ $config['additional_javascript'][] = 'js/quick-reply.js';
+ $config['additional_javascript'][] = 'js/options/user-css.js';
+ $config['additional_javascript'][] = 'js/options/user-js.js';
+ $config['additional_javascript'][] = 'js/forced-anon.js';
+ $config['additional_javascript'][] = 'js/toggle-locked-threads.js';
+ $config['additional_javascript'][] = 'js/toggle-images.js';
+ $config['additional_javascript'][] = 'js/mobile-style.js';
+ $config['additional_javascript'][] = 'js/id_highlighter.js';
+ $config['additional_javascript'][] = 'js/id_colors.js';
+ $config['additional_javascript'][] = 'js/inline.js';
+ $config['additional_javascript'][] = 'js/infinite-scroll.js';
+ $config['additional_javascript'][] = 'js/download-original.js';
+ $config['additional_javascript'][] = 'js/thread-watcher.js';
+
+ //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
+
+ $config['stylesheets']['Dark'] = 'dark.css';
+ $config['stylesheets']['Photon'] = 'photon.css';
+
+ $config['stylesheets_board'] = true;
+ $config['markup'][] = array("/^[ |\t]*==(.+?)==[ |\t]*$/m", "\$1 ");
+ $config['markup'][] = array("/\[spoiler\](.+?)\[\/spoiler\]/", "\$1 ");
+ $config['markup'][] = array("/~~(.+?)~~/", "\$1 ");
+
+ $config['boards'] = array(array(' ' => '/', ' ' => '/boards.html', ' ' => '/faq.html', ' ' => '/random.php', ' ' => '/create.php', ' ' => '/bans.html', ' ' => '/search.php', ' ' => '/mod.php', ' ' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array(''=>'https://twitter.com/infinitechan'));
+ //$config['boards'] = array(array(' ' => '/', ' ' => '/boards.html', ' ' => '/faq.html', ' ' => '/random.php', ' ' => '/create.php', ' ' => '/search.php', ' ' => '/mod.php', ' ' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('v', 'a', 'tg', 'fit', 'pol', 'tech', 'mu', 'co', 'sp', 'boards'), array(''=>'https://twitter.com/infinitechan'));
+
+ $config['footer'][] = 'Contribute to 8chan.co development at github ';
+ $config['footer'][] = 'To make a DMCA request or report illegal content, please email admin@8chan.co or use the "Global Report" functionality on every page.';
+
+ $config['search']['enable'] = true;
+
+//$config['debug'] = true;
+ $config['syslog'] = true;
+
+ $config['wordfilters'][] = array('\rule', ''); // 'true' means it's a regular expression
+
+ if (!function_exists('prettify_textarea')){
+ function prettify_textarea($s){
+ return str_replace("\t", ' ', str_replace("\n", '
', htmlentities($s)));
+ }
+ }
+
+ if (!function_exists('purify')){
+ function purify($s){
+ $config = HTMLPurifier_Config::createDefault();
+ $purifier = new HTMLPurifier($config);
+ $clean_html = $purifier->purify($s);
+ return $clean_html;
+ }
+ }
+
+ $config['mod']['custom_pages']['/banners/(\%b)'] = function($b) {
+ global $config, $mod, $board;
+ require_once 'inc/image.php';
+
+ if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*')
+ error($config['error']['noaccess']);
+
+ if (!openBoard($b))
+ error("Could not open board!");
+
+ $dir = 'static/banners/'.$b;
+
+ if (!is_dir($dir)){
+ mkdir($dir, 0777, true);
+ }
+
+
+ if (isset($_FILES['file'])){
+ $upload = $_FILES['file']['tmp_name'];
+ $banners = array_diff(scandir($dir), array('..', '.'));
+
+ if (!is_readable($upload))
+ error($config['error']['nomove']);
+
+ $id = time() . substr(microtime(), 2, 3);
+ $extension = strtolower(mb_substr($_FILES['file']['name'], mb_strrpos($_FILES['file']['name'], '.') + 1));
+
+ if (!in_array($extension, array('jpg','jpeg','png','gif'))){
+ error('Not an image extension.');
+ }
+
+ if (filesize($upload) > 512000){
+ error('File too large!');
+ }
+
+ if (!$size = @getimagesize($upload)) {
+ error($config['error']['invalidimg']);
+ }
+
+ if ($size[0] != 300 or $size[1] != 100){
+ error('Image wrong size!');
+ }
+ if (sizeof($banners) >= 50) {
+ error('Too many banners.');
+ }
+
+ copy($upload, "$dir/$id.$extension");
+ }
+
+ if (isset($_POST['delete'])){
+ foreach ($_POST['delete'] as $i => $d){
+ if (!preg_match('/[0-9+]\.(png|jpeg|jpg|gif)/', $d)){
+ error('Nice try.');
+ }
+ unlink("$dir/$d");
+ }
+ }
+
+ $banners = array_diff(scandir($dir), array('..', '.'));
+ mod_page(_('Edit banners'), 'mod/banners.html', array('board'=>$board,'banners'=>$banners,'token'=>make_secure_link_token('banners/'.$board['uri'])));
+
+ };
+
+ $config['mod']['custom_pages']['/settings/(\%b)'] = function($b) {
+ global $config, $mod;
+
+ if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*')
+ error($config['error']['noaccess']);
+
+ if (!openBoard($b))
+ error("Could not open board!");
+
+ $possible_languages = array_diff(scandir('inc/locale/'), array('..', '.', '.tx', 'README.md'));
+
+ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ $title = $_POST['title'];
+ $subtitle = $_POST['subtitle'];
+ $country_flags = isset($_POST['country_flags']) ? 'true' : 'false';
+ $field_disable_name = isset($_POST['field_disable_name']) ? 'true' : 'false';
+ $enable_embedding = isset($_POST['enable_embedding']) ? 'true' : 'false';
+ $force_image_op = isset($_POST['force_image_op']) ? 'true' : 'false';
+ $disable_images = isset($_POST['disable_images']) ? 'true' : 'false';
+ $poster_ids = isset($_POST['poster_ids']) ? 'true' : 'false';
+ $show_sages = isset($_POST['show_sages']) ? 'true' : 'false';
+ $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
+ $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
+ $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
+ $allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
+ $code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\[code\](.+?)\[\/code\]/ms", "\$1
");' : '';
+ $katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\[tex\](.+?)\[\/tex\]/ms", "\$1 "); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : '';
+$oekaki_js = << $r ) {
+ if ($r !== '') {
+ $w = $_POST['with'][$i];
+ $replace .= '$config[\'wordfilters\'][] = array(base64_decode(\'' . base64_encode($r) . '\'), base64_decode(\'' . base64_encode($w) . '\'));';
+ }
+ }
+ }
+ }
+
+ if (!(strlen($title) < 40))
+ error('Invalid title');
+ if (!(strlen($subtitle) < 200))
+ error('Invalid subtitle');
+
+ $query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle, `indexed` = :indexed, `public_bans` = :public_bans WHERE `uri` = :uri');
+ $query->bindValue(':title', $title);
+ $query->bindValue(':subtitle', $subtitle);
+ $query->bindValue(':uri', $b);
+ $query->bindValue(':indexed', !isset($_POST['meta_noindex']));
+ $query->bindValue(':public_bans', isset($_POST['public_bans']));
+ $query->execute() or error(db_error($query));
+
+
+ $config_file = <<'Rules', 'subtitle'=>'', 'config'=>$config, 'body'=>''.purify($_POST['rules']).'
')));
+ file_write($b.'/rules.txt', $_POST['rules']);
+ openBoard($b);
+ buildIndex();
+ buildJavascript();
+ $query = query(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL", $b)) or error(db_error());
+ while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
+ buildThread($post['id']);
+ }
+ modLog('Edited board settings', $b);
+ }
+
+ $query = prepare('SELECT * FROM boards WHERE uri = :board');
+ $query->bindValue(':board', $b);
+ $query->execute() or error(db_error($query));
+ $board = $query->fetchAll()[0];
+
+ $rules = @file_get_contents($board['uri'] . '/rules.txt');
+ $css = @file_get_contents('stylesheets/board/' . $board['uri'] . '.css');
+
+ openBoard($b);
+
+ rebuildThemes('bans');
+
+ if ($config['cache']['enabled'])
+ cache::delete('board_' . $board['uri']);
+ cache::delete('all_boards');
+
+ mod_page(_('Board configuration'), 'mod/settings.html', array('board'=>$board, 'rules'=>prettify_textarea($rules), 'css'=>prettify_textarea($css), 'token'=>make_secure_link_token('settings/'.$board['uri']), 'languages'=>$possible_languages));
+ };
+ $config['embedding'] = array(
+ array(
+ '/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
+ 'VIDEO '
+ ),
+ array(
+ '/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
+ ' '
+ ),
+ array(
+ '/^https?:\/\/(\w+\.)?dailymotion\.com\/video\/([a-zA-Z0-9]{2,10})(_.+)?$/i',
+ ' '
+ ),
+ array(
+ '/^https?:\/\/(\w+\.)?metacafe\.com\/watch\/(\d+)\/([a-zA-Z0-9_\-.]+)\/(\?.+)?$/i',
+ '
'
+ ),
+ array(
+ '/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([](.+)?)?$/i',
+ ' '
+ ),
+ array(
+ '/^https?:\/\/(\w+\.)?vocaroo\.com\/i\/([a-zA-Z0-9]{2,15})$/i',
+ ' '
+ )
+ );
+
+$config['gzip_static'] = false;
From 685030159543a1829918a6e125a2699da61210c8 Mon Sep 17 00:00:00 2001
From: unknown <8n-tech@users.noreply.github.com>
Date: Sat, 18 Oct 2014 19:57:51 -0500
Subject: [PATCH 03/12] [#184] Added new files.
---
stylesheets/mod/mod.css | 51 +++++++++++++++++++++++++++++++
templates/mod/header.html | 1 +
templates/mod/report_content.html | 13 ++++++++
3 files changed, 65 insertions(+)
create mode 100644 stylesheets/mod/mod.css
create mode 100644 templates/mod/header.html
create mode 100644 templates/mod/report_content.html
diff --git a/stylesheets/mod/mod.css b/stylesheets/mod/mod.css
new file mode 100644
index 00000000..463b837e
--- /dev/null
+++ b/stylesheets/mod/mod.css
@@ -0,0 +1,51 @@
+.mod-reports {
+ display: block;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+ .mod-report {
+ border: none;
+ border-bottom: 1px solid #B7C5D9;
+ clear: left;
+
+ margin: 0 0 0.5em 0;
+ padding: 0 0 0.5em 0;
+ }
+ .mod-report:last-child {
+ border-bottom: none;
+ }
+
+.report-list {
+ display: block;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+ .report-item {
+ display: inline-block;
+ margin: 0;
+ padding: 0;
+ }
+ .report-item .report {
+ background: #D6DAF0;
+ margin: 0.2em 4px;
+ padding: 0.2em 0.3em 0.5em 0.6em;
+ border-width: 1px;
+ border-style: none solid solid none;
+ border-color: #B7C5D9;
+ display: inline-block;
+ max-width: 94% !important;
+ }
+
+.report-content div.post.reply,
+.report-content div.thread {
+ background: #FFC4C4;
+ margin: 0.2em 4px;
+ padding: 0.2em 0.3em 0.5em 0.6em;
+ border-width: 1px;
+ border-style: none solid solid none;
+ border-color: #F88;
+ display: inline-block;
+ max-width: 94% !important;
+}
\ No newline at end of file
diff --git a/templates/mod/header.html b/templates/mod/header.html
new file mode 100644
index 00000000..b7892795
--- /dev/null
+++ b/templates/mod/header.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/templates/mod/report_content.html b/templates/mod/report_content.html
new file mode 100644
index 00000000..e2a4342e
--- /dev/null
+++ b/templates/mod/report_content.html
@@ -0,0 +1,13 @@
+
+
+
{{ report_title }}
+
+
+
+ {{ content_html }}
+
+
+
+
\ No newline at end of file
From 2d6d449bd2d720241b5774f403d08167bfa25e7c Mon Sep 17 00:00:00 2001
From: unknown <8n-tech@users.noreply.github.com>
Date: Sat, 18 Oct 2014 20:07:04 -0500
Subject: [PATCH 04/12] [#184] Added tag classes. Style selector now
adds a class. Moved board list under moderator dashboard.
---
d | 553 ++++++++++++++++++++++++++++++
inc/instance-config.php | 14 +-
inc/mod/pages.php | 210 ++++++++----
install.php | 32 +-
stylesheets/style.css | 2 +-
templates/8chan/index.html | 2 +-
templates/generic_page.html | 2 +-
templates/index.html | 2 +-
templates/main.js | 100 ++++--
templates/mod/dashboard.html | 170 ++++-----
templates/mod/report.html | 42 +--
templates/mod/reports.html | 4 +-
templates/page.html | 3 +-
templates/post_thread.html | 2 +-
templates/themes/basic/index.html | 2 +-
templates/thread.html | 2 +-
16 files changed, 915 insertions(+), 227 deletions(-)
create mode 100644 d
diff --git a/d b/d
new file mode 100644
index 00000000..09ddbcc5
--- /dev/null
+++ b/d
@@ -0,0 +1,553 @@
+[1mdiff --git a/inc/instance-config.php b/inc/instance-config.php[m
+[1mindex 699d1a1..475f3ed 100644[m
+[1m--- a/inc/instance-config.php[m
+[1m+++ b/inc/instance-config.php[m
+[36m@@ -18,15 +18,15 @@[m
+ $config['db']['user'] = 'root';[m
+ $config['db']['password'] = '';[m
+ $config['timezone'] = 'UTC';[m
+[31m- $config['cache']['enabled'] = 'apc';[m
+[31m-[m
+[31m-[m
+[32m+[m [32m$config['cache']['enabled'] = false;[m
+[32m+[m[41m [m
+[32m+[m[41m [m
+ $config['cookies']['mod'] = 'mod';[m
+ $config['cookies']['salt'] = '';[m
+[31m-[m
+[32m+[m[41m [m
+ $config['spam']['hidden_inputs_max_pass'] = 128;[m
+ $config['spam']['hidden_inputs_expire'] = 60 * 60 * 4; // three hours[m
+[31m-[m
+[32m+[m[41m [m
+ $config['flood_time'] = 5;[m
+ $config['flood_time_ip'] = 30;[m
+ $config['flood_time_same'] = 2;[m
+[36m@@ -46,10 +46,10 @@[m
+ $config['thread_subject_in_title'] = true;[m
+ $config['spam']['hidden_inputs_max_pass'] = 128;[m
+ $config['ayah_enabled'] = true;[m
+[31m-[m
+[32m+[m[41m [m
+ // Load database credentials[m
+ require "secrets.php";[m
+[31m-[m
+[32m+[m[41m [m
+ // Image shit[m
+ $config['thumb_method'] = 'gm+gifsicle';[m
+ $config['thumb_ext'] = '';[m
+[1mdiff --git a/install.php b/install.php[m
+[1mindex 8b3815a..07e94e7 100644[m
+[1m--- a/install.php[m
+[1m+++ b/install.php[m
+[36m@@ -579,7 +579,8 @@[m [mif ($step == 0) {[m
+ ';[m
+ [m
+ echo Element('page.html', $page);[m
+[31m-} elseif ($step == 1) {[m
+[32m+[m[32m}[m
+[32m+[m[32melseif ($step == 1) {[m
+ $page['title'] = 'Pre-installation test';[m
+ [m
+ $can_exec = true;[m
+[36m@@ -761,7 +762,8 @@[m [mif ($step == 0) {[m
+ 'title' => 'Checking environment',[m
+ 'config' => $config[m
+ ));[m
+[31m-} elseif ($step == 2) {[m
+[32m+[m[32m}[m
+[32m+[m[32melseif ($step == 2) {[m
+ // Basic config[m
+ $page['title'] = 'Configuration';[m
+ [m
+[36m@@ -775,7 +777,8 @@[m [mif ($step == 0) {[m
+ 'title' => 'Configuration',[m
+ 'config' => $config[m
+ ));[m
+[31m-} elseif ($step == 3) {[m
+[32m+[m[32m}[m
+[32m+[m[32melseif ($step == 3) {[m
+ $instance_config = [m
+ 'I couldn\'t write to inc/instance-config.php with the new configuration, probably due to a permissions error.[m
+[36m@@ -826,7 +830,8 @@[m [mif ($step == 0) {[m
+ ';[m
+ echo Element('page.html', $page);[m
+ }[m
+[31m-} elseif ($step == 4) {[m
+[32m+[m[32m}[m
+[32m+[m[32melseif ($step == 4) {[m
+ // SQL installation[m
+ [m
+ buildJavascript();[m
+[36m@@ -846,11 +851,15 @@[m [mif ($step == 0) {[m
+ [m
+ $sql_errors = '';[m
+ foreach ($queries as $query) {[m
+[31m- if ($mysql_version < 50503)[m
+[32m+[m [32mif ($mysql_version < 50503) {[m
+ $query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);[m
+[32m+[m [32m}[m
+[32m+[m[41m [m
+ $query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query);[m
+[31m- if (!query($query))[m
+[32m+[m[41m [m
+[32m+[m [32mif (!query($query)) {[m
+ $sql_errors .= '' . db_error() . ' ';[m
+[32m+[m [32m}[m
+ }[m
+ [m
+ $page['title'] = 'Installation complete';[m
+[36m@@ -858,7 +867,8 @@[m [mif ($step == 0) {[m
+ [m
+ if (!empty($sql_errors)) {[m
+ $page['body'] .= 'SQL errors SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a vichan installation; if so, you can probably ignore this.
The errors encountered were:
Ignore errors and complete installation.
';[m
+[31m- } else {[m
+[32m+[m [32m}[m
+[32m+[m [32melse {[m
+ $boards = listBoards();[m
+ foreach ($boards as &$_board) {[m
+ setupBoard($_board);[m
+[36m@@ -866,13 +876,11 @@[m [mif ($step == 0) {[m
+ }[m
+ [m
+ file_write($config['has_installed'], VERSION);[m
+[31m- /*if (!file_unlink(__FILE__)) {[m
+[31m- $page['body'] .= 'Delete install.php! I couldn\'t remove install.php . You will have to remove it manually.
';[m
+[31m- }*/[m
+ }[m
+ [m
+ echo Element('page.html', $page);[m
+[31m-} elseif ($step == 5) {[m
+[32m+[m[32m}[m
+[32m+[m[32melseif ($step == 5) {[m
+ $page['title'] = 'Installation complete';[m
+ $page['body'] = 'Thank you for using vichan. Please remember to report any bugs you discover.
';[m
+ [m
+[1mdiff --git a/templates/8chan/index.html b/templates/8chan/index.html[m
+[1mindex 459e7e8..4f25473 100644[m
+[1m--- a/templates/8chan/index.html[m
+[1m+++ b/templates/8chan/index.html[m
+[36m@@ -223,7 +223,7 @@[m
+ [m
+ [m
+ [m
+[31m- [m
+[32m+[m[32m [m
+ [m
+ [m
+ [m
+[1mdiff --git a/templates/generic_page.html b/templates/generic_page.html[m
+[1mindex 0fe1f9c..4cd3116 100644[m
+[1m--- a/templates/generic_page.html[m
+[1m+++ b/templates/generic_page.html[m
+[36m@@ -6,7 +6,7 @@[m
+
{{ board.url }} - {{ board.name }} [m
+ {% endblock %}[m
+ [m
+[31m- [m
+[32m+[m[32m[m
+ {{ boardlist.top }}[m
+ {% if pm %}
You have
an unread PM {% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.
{% endif %}[m
+ {% if config.url_banner %}
{% endif %}[m
+[1mdiff --git a/templates/index.html b/templates/index.html[m
+[1mindex aae87c1..5638fd6 100644[m
+[1m--- a/templates/index.html[m
+[1m+++ b/templates/index.html[m
+[36m@@ -14,7 +14,7 @@[m
+ {% include 'header.html' %}[m
+
{{ board.url }} - {{ board.title|e }} [m
+ [m
+[31m- [m
+[32m+[m[32m[m
+ {{ boardlist.top }}[m
+ [m
+ {% if pm %}
You have
an unread PM {% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.
{% endif %}[m
+[1mdiff --git a/templates/main.js b/templates/main.js[m
+[1mindex 1ec4d26..d100f93 100644[m
+[1m--- a/templates/main.js[m
+[1m+++ b/templates/main.js[m
+[36m@@ -73,11 +73,6 @@[m [mvar saved = {};[m
+ [m
+ [m
+ var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}';[m
+[31m-/*var styles = {[m
+[31m- {% endraw %}[m
+[31m- {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',[m
+[31m- {% endraw %}{% endfor %}{% raw %}[m
+[31m-};*/[m
+ var board_name = false;[m
+ [m
+ function changeStyle(styleName, link) {[m
+[36m@@ -92,36 +87,78 @@[m [mfunction changeStyle(styleName, link) {[m
+ {% endif %}[m
+ {% raw %}[m
+ [m
+[31m- if (!document.getElementById('stylesheet')) {[m
+[31m- var s = document.createElement('link');[m
+[31m- s.rel = 'stylesheet';[m
+[31m- s.type = 'text/css';[m
+[31m- s.id = 'stylesheet';[m
+[32m+[m [32m// Find the
for the stylesheet. May be nothing.[m
+[32m+[m [32mvar domStylesheet = document.getElementById('stylesheet');[m
+[32m+[m [32m// Determine if this stylesheet is the default.[m
+[32m+[m [32mvar setToDefault = ( styles[styleName] == "" || styles[styleName] == "/stylesheets/" );[m
+[32m+[m [32m// Turn "Yotsuba B" to "yotsuba_b"[m[41m [m
+[32m+[m [32mvar attributeName = styleName.replace(/[^a-z0-9_\-]/gi, '_').toLowerCase();[m
+[32m+[m[41m [m
+[32m+[m [32mif( !domStylesheet && !setToDefault ) {[m
+[32m+[m [32mdomStylesheet = document.createElement('link');[m
+[32m+[m [32mdomStylesheet.rel = 'stylesheet';[m
+[32m+[m [32mdomStylesheet.type = 'text/css';[m
+[32m+[m [32mdomStylesheet.id = 'stylesheet';[m
+[32m+[m[41m [m
+ var x = document.getElementsByTagName('head')[0];[m
+[31m- x.appendChild(s);[m
+[32m+[m [32mx.appendChild(domStylesheet);[m
+ }[m
+[31m-[m
+[31m- {% endraw %}[m
+[31m- var root = "{{ config.root }}";[m
+[31m- {% raw %}[m
+[31m- root = root.replace(/\/$/, "");[m
+[31m- [m
+[31m- document.getElementById('stylesheet').href = root + styles[styleName];[m
+[31m- selectedstyle = styleName;[m
+ [m
+[31m- if (document.getElementsByClassName('styles').length != 0) {[m
+[31m- var styleLinks = document.getElementsByClassName('styles')[0].childNodes;[m
+[31m- for (var i = 0; i < styleLinks.length; i++) {[m
+[31m- styleLinks[i].className = '';[m
+[32m+[m [32mif( !setToDefault ) {[m
+[32m+[m [32m{% endraw %}[m
+[32m+[m [32mvar root = "{{ config.root }}";[m
+[32m+[m [32m{% raw %}[m
+[32m+[m [32mroot = root.replace(/\/$/, "");[m
+[32m+[m[41m [m
+[32m+[m [32mdomStylesheet.href = root + styles[styleName];[m
+[32m+[m [32mselectedstyle = styleName;[m
+[32m+[m[41m [m
+[32m+[m [32mif (document.getElementsByClassName('styles').length != 0) {[m
+[32m+[m [32mvar styleLinks = document.getElementsByClassName('styles')[0].childNodes;[m
+[32m+[m [32mfor (var i = 0; i < styleLinks.length; i++) {[m
+[32m+[m [32mstyleLinks[i].className = '';[m
+[32m+[m [32m}[m
+ }[m
+[32m+[m[41m [m
+[32m+[m [32mif (link) {[m
+[32m+[m [32mlink.className = 'selected';[m
+[32m+[m [32m}[m
+[32m+[m [32m}[m
+[32m+[m [32melse if( domStylesheet ) {[m
+[32m+[m [32mdomStylesheet.parentNode.removeChild( domStylesheet );[m
+ }[m
+ [m
+[31m- if (link) {[m
+[31m- link.className = 'selected';[m
+[32m+[m [32m// Fix the classes on the body tag.[m
+[32m+[m [32mvar body = document.getElementsByTagName('body')[0];[m
+[32m+[m[41m [m
+[32m+[m [32mif( body ) {[m
+[32m+[m [32mvar bodyClasses = document.getElementsByTagName('body')[0].getAttribute('class').split(" ");[m
+[32m+[m [32mvar bodyClassesNew = [];[m
+[32m+[m[41m [m
+[32m+[m [32mfor( i = 0; i < bodyClasses.length; ++i ) {[m
+[32m+[m [32mvar bodyClass = bodyClasses[ i ];[m
+[32m+[m[41m [m
+[32m+[m [32m// null class from a double-space.[m
+[32m+[m [32mif( bodyClass == "" ) {[m
+[32m+[m [32mcontinue;[m
+[32m+[m [32m}[m
+[32m+[m[41m [m
+[32m+[m [32mif( bodyClass.indexOf( "stylesheet-" ) == 0 ) {[m
+[32m+[m [32mcontinue;[m
+[32m+[m [32m}[m
+[32m+[m[41m [m
+[32m+[m [32mbodyClassesNew.push( bodyClass );[m
+[32m+[m [32m}[m
+[32m+[m[41m [m
+[32m+[m [32m// Add stylesheet-yotsuba_b at the end.[m
+[32m+[m [32mbodyClassesNew.push( "stylesheet-" + attributeName );[m
+[32m+[m [32mbody.setAttribute( 'class', bodyClassesNew.join(" ") );[m
+[32m+[m [32mbody.setAttribute( 'data-stylesheet', attributeName );[m
+ }[m
+ [m
+[31m- if (typeof $ != 'undefined')[m
+[32m+[m [32mif (typeof $ != 'undefined') {[m
+ $(window).trigger('stylesheet', styleName);[m
+[32m+[m [32m}[m
+ }[m
+ [m
+ [m
+[36m@@ -167,7 +204,7 @@[m [mfunction init_stylechooser() {[m
+ }[m
+ }[m
+ }[m
+[31m- {% endraw%}[m
+[32m+[m [32m{% endraw %}[m
+ {% else %}[m
+ {% raw %}[m
+ if (localStorage.stylesheet) {[m
+[36m@@ -185,10 +222,13 @@[m [mfunction init_stylechooser() {[m
+ [m
+ function get_cookie(cookie_name) {[m
+ var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');[m
+[31m- if (results)[m
+[32m+[m[41m [m
+[32m+[m [32mif (results) {[m
+ return (unescape(results[2]));[m
+[31m- else[m
+[32m+[m [32m}[m
+[32m+[m [32melse {[m
+ return null;[m
+[32m+[m [32m}[m
+ }[m
+ [m
+ function highlightReply(id) {[m
+[1mdiff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html[m
+[1mindex 4f76625..87e67c8 100644[m
+[1m--- a/templates/mod/dashboard.html[m
+[1m+++ b/templates/mod/dashboard.html[m
+[36m@@ -1,40 +1,5 @@[m
+[31m-[m
+[31m- {% trans 'Boards' %} [m
+[31m- [m
+[31m- [m
+[31m- {% for board in boards %}[m
+[31m- {% if board.uri in mod.boards or mod.boards[0] == '*' %}[m
+[31m- [m
+[31m- {{ config.board_abbreviation|sprintf(board.uri) }} [m
+[31m- - [m
+[31m- {{ board.title|e }}[m
+[31m- {% if board.subtitle %}[m
+[31m- — [m
+[31m- {% if config.allow_subtitle_html %}[m
+[31m- {{ board.subtitle }}[m
+[31m- {% else %}[m
+[31m- {{ board.subtitle|e }}[m
+[31m- {% endif %}[m
+[31m- [m
+[31m-[m
+[31m- {% endif %}[m
+[31m- {% if mod.type == "20" %}[m
+[31m- [{% trans 'settings' %}] [m
+[31m- {% endif %}[m
+[31m- {% if mod|hasPermission(config.mod.manageboards) %}[m
+[31m- [{% trans 'edit' %}] [m
+[31m- {% endif %}[m
+[31m- [m
+[31m- {% endif %}[m
+[31m- {% endfor %}[m
+[31m- [m
+[31m- {% if mod|hasPermission(config.mod.newboard) %}[m
+[31m- {% trans 'Create new board' %} [m
+[31m- {% endif %}[m
+[31m- [m
+[31m- [m
+[31m-[m
+[31m-[m
+[32m+[m[32m[m
+[32m+[m[32m[m
+ {% trans 'Messages' %} [m
+ [m
+ {% if mod|hasPermission(config.mod.noticeboard) %}[m
+[36m@@ -78,7 +43,8 @@[m
+ [m
+ [m
+ [m
+[31m-[m
+[32m+[m[32m[m
+[32m+[m[32m[m
+ {% trans 'Administration' %} [m
+ [m
+ [m
+[36m@@ -123,57 +89,99 @@[m
+ [m
+ [m
+ [m
+[32m+[m[32m[m
+ {% if mod|hasPermission(config.mod.search) %}[m
+[31m- [m
+[31m- {% trans 'Search' %} [m
+[31m- [m
+[31m- [m
+[32m+[m[32m[m
+[32m+[m [32m{% trans 'Search' %} [m
+[32m+[m[41m [m
+[32m+[m [32m[m
+[32m+[m [32m[m
+[32m+[m [32m{% include 'mod/search_form.html' %}[m
+[32m+[m [32m [m
+[32m+[m [32m [m
+[32m+[m[32m [m
+[32m+[m[32m{% endif %}[m
+[32m+[m
+[32m+[m[32m[m
+[32m+[m[32m[m
+[32m+[m [32m{% trans 'Boards' %} [m
+[32m+[m[41m [m
+[32m+[m [32m[m
+[32m+[m [32m{% for board in boards %}[m
+[32m+[m [32m{% if board.uri in mod.boards or mod.boards[0] == '*' %}[m
+ [m
+[31m- {% include 'mod/search_form.html' %}[m
+[32m+[m [32m{{ config.board_abbreviation|sprintf(board.uri) }} [m
+[32m+[m [32m -[m[41m [m
+[32m+[m [32m{{ board.title|e }}[m
+[32m+[m [32m{% if board.subtitle %}[m
+[32m+[m [32m—[m[41m [m
+[32m+[m [32m{% if config.allow_subtitle_html %}[m
+[32m+[m [32m{{ board.subtitle }}[m
+[32m+[m [32m{% else %}[m
+[32m+[m [32m{{ board.subtitle|e }}[m
+[32m+[m [32m{% endif %}[m
+[32m+[m [32m [m
+[32m+[m
+[32m+[m [32m{% endif %}[m
+[32m+[m [32m{% if mod.type == "20" %}[m
+[32m+[m [32m[{% trans 'settings' %}] [m
+[32m+[m [32m{% endif %}[m
+[32m+[m [32m{% if mod|hasPermission(config.mod.manageboards) %}[m
+[32m+[m [32m [{% trans 'edit' %}] [m
+[32m+[m [32m{% endif %}[m
+ [m
+[31m- [m
+[31m- [m
+[31m-{% endif %}[m
+[32m+[m [32m{% endif %}[m
+[32m+[m [32m{% endfor %}[m
+[32m+[m[41m [m
+[32m+[m [32m{% if mod|hasPermission(config.mod.newboard) %}[m
+[32m+[m [32m{% trans 'Create new board' %} [m
+[32m+[m [32m{% endif %}[m
+[32m+[m [32m [m
+[32m+[m[32m [m
+ [m
+[32m+[m[32m[m
+ {% if config.mod.dashboard_links|count %}[m
+[31m- [m
+[31m- {% trans 'Other' %} [m
+[31m- [m
+[31m- [m
+[31m- {% for label,link in config.mod.dashboard_links %}[m
+[31m- {{ label }} [m
+[31m- {% endfor %}[m
+[31m- [m
+[31m- [m
+[32m+[m[32m[m
+[32m+[m [32m{% trans 'Other' %} [m
+[32m+[m
+[32m+[m [32m[m
+[32m+[m [32m{% for label,link in config.mod.dashboard_links %}[m
+[32m+[m [32m{{ label }} [m
+[32m+[m [32m{% endfor %}[m
+[32m+[m [32m [m
+[32m+[m[32m [m
+ {% endif %}[m
+ [m
+[32m+[m[32m[m
+ {% if config.debug %}[m
+[31m- [m
+[31m- {% trans 'Debug' %} [m
+[31m- [m
+[31m- [m
+[32m+[m[32m[m
+[32m+[m [32m{% trans 'Debug' %} [m
+[32m+[m [32m[m
+[32m+[m[32m [m
+ {% endif %}[m
+ [m
+[32m+[m[32m[m
+ {% if newer_release %}[m
+[31m- [m
+[31m- Update [m
+[31m- [m
+[31m- [m
+[31m- A newer version of Tinyboard [m
+[31m- (v{{ newer_release.massive }}.{{ newer_release.major }}.{{ newer_release.minor }} ) is available! [m
+[31m- See http://tinyboard.org/ for upgrade instructions.[m
+[31m- [m
+[31m- [m
+[31m- [m
+[32m+[m[32m[m
+[32m+[m [32mUpdate [m
+[32m+[m [32m[m
+[32m+[m [32m[m
+[32m+[m [32mA newer version of Tinyboard[m[41m [m
+[32m+[m [32m(v{{ newer_release.massive }}.{{ newer_release.major }}.{{ newer_release.minor }} ) is available![m[41m [m
+[32m+[m [32mSee http://tinyboard.org/ for upgrade instructions.[m
+[32m+[m [32m [m
+[32m+[m [32m [m
+[32m+[m[32m [m
+ {% endif %}[m
+ [m
+[31m-[m
+[32m+[m[32m[m
+[32m+[m[32m[m
+ {% trans 'User account' %} [m
+ [m
+