From b28fc414b0ebf91bf8743c9cc3adc7bdb8725264 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 01:16:42 -0800 Subject: [PATCH 1/7] Make removing board from favorites on 404 actually work --- 404.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/404.php b/404.php index a9a29c36..0e1b634f 100644 --- a/404.php +++ b/404.php @@ -35,7 +35,7 @@ $page = << Date: Wed, 12 Nov 2014 01:17:34 -0800 Subject: [PATCH 2/7] lol --- faq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faq.php b/faq.php index 6c039741..cc4dbd93 100644 --- a/faq.php +++ b/faq.php @@ -79,7 +79,7 @@ $body = <<There isn't one yet and there will never be an official archive.

How do I donate?

-

Donations can be sent to 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C (Bitcoin) or LUPgSCJt3iGeJXUETVhmnbQ89Riaq1yjZm (Litecoin). PayPal is also accepted @ fredrick.brennan1@gmail.com .

+

Donations can be sent to 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C (Bitcoin) or LUPgSCJt3iGeJXUETVhmnbQ89Riaq1yjZm (Litecoin).

You may also donate monthly via Patreon at http://www.patreon.com/user?u=162165.

Are you really a cripple?

From 802dd12c7ccd079851404415a6a3472e40da8004 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 01:19:02 -0800 Subject: [PATCH 3/7] Have to load onready --- js/thread-stats.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/thread-stats.js b/js/thread-stats.js index 59fed912..4050fb67 100644 --- a/js/thread-stats.js +++ b/js/thread-stats.js @@ -8,8 +8,9 @@ * $config['additional_javascript'][] = 'js/thread-stats.js'; */ if (active_page == 'thread') { +$(document).ready(function(){ //check if page uses unique ID - var IDsupport = ($('.poster_id').length > 0); + var IDsupport = ($('.poster_id').length > 0); var thread_id = (document.location.pathname + document.location.search).split('/'); thread_id = thread_id[thread_id.length -1].split('+')[0].split('.')[0]; @@ -100,10 +101,9 @@ if (active_page == 'thread') { if (!found) $('#thread_stats_page').css('color','red'); }); },30000); - $(document).ready(function(){ $('body').append(''); update_thread_stats(); $('#update_thread').click(update_thread_stats); $(document).on('new_post',update_thread_stats); - }); -} \ No newline at end of file +}); +} From 47aa1a520d1013f680c66a91f015ad1e30100526 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 21:04:58 -0800 Subject: [PATCH 4/7] Bug: Banners weren't displaying if board was over 10 chars long --- banners.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/banners.php b/banners.php index 10604ea8..2707ca5c 100644 --- a/banners.php +++ b/banners.php @@ -8,7 +8,7 @@ header("Expires: 0"); function get_custom_banner(&$b) { # Validate the board name - if (!(isset($b) && preg_match('/^[a-z0-9]{1,10}$/', $b))) + if (!(isset($b) && preg_match('/^[a-z0-9]{1,30}$/', $b))) return null; # Check if directory exists From 4f2398f7b88f9418db3c35876daca4fd18b988fa Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 21:06:58 -0800 Subject: [PATCH 5/7] Make deletePost more tolerant of errors Sometimes thumbnail generation fails but the post is still there, sometimes post deletion is aborted halfway through Ignore errors from file_unlink and don't fail if $f->file, $f->thumb not set --- inc/functions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 3504cc38..2ffdc222 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1091,9 +1091,9 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { if (!$post['thread']) { // Delete thread HTML page - file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['id'])); - file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $post['id'])); - file_unlink($board['dir'] . $config['dir']['res'] . sprintf('%d.json', $post['id'])); + @file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['id'])); + @file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $post['id'])); + @file_unlink($board['dir'] . $config['dir']['res'] . sprintf('%d.json', $post['id'])); $antispam_query = prepare('DELETE FROM ``antispam`` WHERE `board` = :board AND `thread` = :thread'); $antispam_query->bindValue(':board', $board['uri']); @@ -1106,9 +1106,9 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { if ($post['files']) { // Delete file foreach (json_decode($post['files']) as $i => $f) { - if ($f->file !== 'deleted') { - file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $f->file); - file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $f->thumb); + if (isset($f->file, $f->thumb) && $f->file !== 'deleted') { + @file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $f->file); + @file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $f->thumb); } } } From 1267c60a2c5755c35ad7132e7462a224fbc08328 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 21:08:32 -0800 Subject: [PATCH 6/7] SECURITY: CSRF in post.php --- post.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/post.php b/post.php index 881c7e01..650b431b 100644 --- a/post.php +++ b/post.php @@ -232,15 +232,16 @@ elseif (isset($_POST['post'])) { } } - if (!(($post['op'] && $_POST['post'] == $config['button_newtopic']) || - (!$post['op'] && $_POST['post'] == $config['button_reply']))) + //if (!(($post['op'] && $_POST['post'] == $config['button_newtopic']) || + //(!$post['op'] && $_POST['post'] == $config['button_reply']))) //error($config['error']['bot']); // Check the referrer if ($config['referer_match'] !== false && - (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], rawurldecode($_SERVER['HTTP_REFERER'])))) + (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], rawurldecode($_SERVER['HTTP_REFERER'])))) { error($config['error']['referer']); - + } + checkDNSBL(); // Check if banned From f944116a7caa54bed003d052b251485536efe94c Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 12 Nov 2014 21:08:48 -0800 Subject: [PATCH 7/7] Enabe thread stats --- inc/instance-config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/instance-config.php b/inc/instance-config.php index d888b71f..aa45f960 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -135,6 +135,7 @@ $config['additional_javascript'][] = 'js/youtube.js'; $config['additional_javascript'][] = 'js/comment-toolbar.js'; $config['additional_javascript'][] = 'js/catalog-search.js'; + $config['additional_javascript'][] = 'js/thread-stats.js'; //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';