From 415cf20abb0286698a2a418c60f13f78a0a92f70 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 31 Jan 2015 23:30:59 -0800 Subject: [PATCH 01/50] Shift-click to hide threads in catalog --- js/catalog.js | 12 ++++++++++-- templates/themes/catalog/catalog.html | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/js/catalog.js b/js/catalog.js index 801c86bc..38382096 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -1,5 +1,4 @@ if (active_page == 'catalog') $(function(){ - if (localStorage.catalog !== undefined) { var catalog = JSON.parse(localStorage.catalog); } else { @@ -15,8 +14,18 @@ if (active_page == 'catalog') $(function(){ $('a[href$="/'+k+'.html"]').parents('.mix').remove(); }); } + } else { + hidden_data = {}; } + $(document).on('click', '.mix', function(e) { + if (e.shiftKey) { + hidden_data[board_name][$(this).data('id')] = Math.round(Date.now() / 1000); + $(this).remove(); + localStorage.hiddenthreads = JSON.stringify(hidden_data); + } + }); + $("#sort_by").change(function(){ var value = this.value; $('#Grid').mixItUp('sort', value); @@ -46,5 +55,4 @@ if (active_page == 'catalog') $(function(){ if (catalog.image_size !== undefined) { $('#image_size').val(catalog.image_size).trigger('change'); } - }); diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 82383364..ca3dd923 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -38,6 +38,7 @@ data-reply="{{ post.reply_count }}" data-bump="{{ post.bump }}" data-time="{{ post.time }}" + data-id="{{ post.id }}" >
From 114452a37fbcc5b1150e5b7844f9d4740060cd3c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 31 Jan 2015 23:31:36 -0800 Subject: [PATCH 02/50] Update FAQ --- faq.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/faq.php b/faq.php index 75448146..d01befae 100644 --- a/faq.php +++ b/faq.php @@ -79,8 +79,9 @@ $body = <<__underline__ -> underline
  • ==heading== -> heading (must be on own line)
  • ~~strikethrough~~ -> strikethrough
  • +
  • [aa] tags for ASCII/JIS art (escape formatting)
  • [code] tags if enabled by board owner
  • -
  • [tex] tags if enabled by board owner
  • +
  • [tex] tags if enabled by board owner (currently globally disabled)
  • How are featured boards chosen?

    @@ -110,10 +111,14 @@ $body = <<claim at 8chan dot co +

    I would like to send you an encrypted message.

    +

    The current admin contact private key can always be found at https://8ch.net/pubkey.txt.

    +

    The current key fingerprint is 6F12 EC72 A82A BCA3 5235 063A 10DD C983 901A A183.

    +

    How do I donate?

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

    I am also a big fan of Monero (XMR). You can send XMR to our OpenAlias in the simplewallet client, or simply send to 49dBJhGhYFxJEfydS6hH6GRyg1W4cDgupdNVtw7j1WtcUY7xPXwNLw6fUVay644viaCcEhMFG1Z7SjjxRXEFDdNWJdvH9kS.

    -

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

    If you would like to support development of the engine that 8chan runs on (infinity), you may also donate via Gratipay.

    Are you really a cripple?

    Yes.

    From 0cef3a8d043141dd43329c6f88f7434098c595e5 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:10:35 -0800 Subject: [PATCH 03/50] Fix claim --- claim.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claim.php b/claim.php index b1b155c6..456c8a32 100644 --- a/claim.php +++ b/claim.php @@ -31,7 +31,7 @@ function last_activity($board) { } else {// no one ever logged in, try board creation time $query = query("SELECT UNIX_TIMESTAMP(time) AS time FROM board_create WHERE uri = '$board'"); $crt = $query->fetchAll(PDO::FETCH_COLUMN); - $last_activity_date->setTimestamp($crt[0]); + if ($crt) $last_activity_date->setTimestamp($crt[0]); $last_mod_date = false; } } From c3ff6daa5317b83f5f40585dfa37e506118e1d79 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:11:21 -0800 Subject: [PATCH 04/50] Billion laughs detection in wordfilters --- inc/8chan-mod-pages.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index b87a97ae..62aee08a 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -14,6 +14,28 @@ } } + if (!function_exists('is_billion_laughs')){ + function is_billion_laughs($arr1, $arr2) { + $arr = array(); + foreach ($arr1 as $k => $v) { + $arr[$v] = $arr2[$k]; + } + + for ($i = 0; $i <= sizeof($arr); $i++) { + $cur = array_slice($arr, $i, 1); + $pst = array_slice($arr, 0, $i); + if (!$cur) continue; + $kk = array_keys($cur)[0]; + $vv = array_values($cur)[0]; + foreach ($pst as $k => $v) { + if (str_replace($kk, $vv, $v) != $v) + return true; + } + } + return false; + } + } + $config['mod']['show_ip'] = GLOBALVOLUNTEER; $config['mod']['show_ip_less'] = BOARDVOLUNTEER; $config['mod']['manageusers'] = GLOBALVOLUNTEER; @@ -459,6 +481,9 @@ OEKAKI; } } } + if (is_billion_laughs($_POST['replace'], $_POST['with'])) { + error(_('Wordfilters may not wordfilter previous wordfilters. For example, if a filters to bb and b filters to cc, that is not allowed.')); + } } if (isset($_POST['hour_max_threads']) && in_array($_POST['hour_max_threads'], ['10', '25', '50', '100'])) { From b6abb4ab4f46548d3de4f8cf11058e2915c38368 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:14:05 -0800 Subject: [PATCH 05/50] Allow global volunteers to move threads --- inc/8chan-mod-pages.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 62aee08a..65c96290 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -76,6 +76,8 @@ $config['mod']['view_ban_appeals'] = BOARDVOLUNTEER; $config['mod']['view_ban'] = BOARDVOLUNTEER; $config['mod']['reassign_board'] = ADMIN; + $config['mod']['move'] = GLOBALVOLUNTEER; + $config['mod']['shadow_capcode'] = 'Mod'; $config['mod']['custom_pages']['/tags/(\%b)'] = function ($b) { global $board, $config; From 0eb307381900c52c6028cd36a9d090ae6376a407 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:14:40 -0800 Subject: [PATCH 06/50] Tor posting ?/settings option --- inc/8chan-mod-pages.php | 2 ++ templates/mod/settings.html | 1 + 2 files changed, 3 insertions(+) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 65c96290..809013e1 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -432,6 +432,7 @@ FLAGS; $user_flags = isset($_POST['user_flags']) ? "if (file_exists('$b/flags.php')) { include 'flags.php'; }\n" : ''; $captcha = isset($_POST['captcha']) ? 'true' : 'false'; $force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false'; + $tor_posting = isset($_POST['tor_posting']) ? 'true' : 'false'; @@ -529,6 +530,7 @@ OEKAKI; \$config['default_stylesheet'] = array('Custom', \$config['stylesheets']['Custom']); \$config['captcha']['enabled'] = $captcha; \$config['force_subject_op'] = $force_subject_op; +\$config['tor_posting'] = $tor_posting; \$config['hour_max_threads'] = $hour_max_threads; $code_tags $katex $oekaki $replace $multiimage $allow_flash $allow_pdf $user_flags if (\$config['disable_images']) diff --git a/templates/mod/settings.html b/templates/mod/settings.html index ce68ec41..2ac8ddb6 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -45,6 +45,7 @@ {% trans %}Enable dice rolling{% endtrans %} {% trans %}Don't allow users to repost images{% endtrans %} {% trans %}Allow a poster to delete his own posts{% endtrans %} + {% trans %}Allow posters to post via the Tor onion router{% endtrans %}
    Disabling this is evil, but if you really care about "ban evasion", here you go. {% trans %}Enable CAPTCHA{% endtrans %}
    This is not ReCAPTCHA, it is custom to 8chan {% trans %}Language{% endtrans %}
    {% trans %}To contribute translations, register at Transifex{% endtrans %} {% trans %}Show only bans from boards I moderate{% endtrans %} - {% endif %}
    From 2cb1bbe3dab4d37d57d5d9b7cebf7b7d829c2dc9 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:19:55 -0800 Subject: [PATCH 10/50] Fix webm bug: Wrong max length shown in error message --- inc/config.php | 2 +- inc/lib/webm/ffmpeg.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/config.php b/inc/config.php index 956395c9..1d937561 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1105,7 +1105,7 @@ $config['error']['webmerror'] = _('There was a problem processing your webm.');//Is this error used anywhere ? $config['error']['invalidwebm'] = _('Invalid webm uploaded.'); $config['error']['webmhasaudio'] = _('The uploaded webm contains an audio or another type of additional stream.'); - $config['error']['webmtoolong'] = _('The uploaded webm is longer than ' . $config['webm']['max_length'] . ' seconds.'); + $config['error']['webmtoolong'] = _('The uploaded webm is longer than %d seconds.'); $config['error']['fileexists'] = _('That file already exists!'); $config['error']['fileexistsinthread'] = _('That file already exists in this thread!'); $config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.'); diff --git a/inc/lib/webm/ffmpeg.php b/inc/lib/webm/ffmpeg.php index 485e4702..f867c8db 100644 --- a/inc/lib/webm/ffmpeg.php +++ b/inc/lib/webm/ffmpeg.php @@ -50,7 +50,7 @@ function is_valid_webm($ffprobe_out) { return array('code' => 2, 'msg' => $config['error']['invalidwebm']); if ($ffprobe_out['format']['duration'] > $config['webm']['max_length']) - return array('code' => 4, 'msg' => $config['error']['webmtoolong']); + return array('code' => 4, 'msg' => sprintf($config['error']['webmtoolong'], $config['webm']['max_length'])); } function make_webm_thumbnail($filename, $thumbnail, $width, $height, $duration) { From 11b1d2fcb98211d8207f7171ec0f1c3d3bb26a19 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:20:14 -0800 Subject: [PATCH 11/50] Add email selectbox to forced anonymous --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 1d937561..72d4e723 100644 --- a/inc/config.php +++ b/inc/config.php @@ -554,7 +554,7 @@ $config['field_disable_password'] = false; // When true, users are instead presented a selectbox for email. Contains, blank, noko and sage. - $config['field_email_selectbox'] = false; + $config['field_email_selectbox'] = &$config['field_disable_name']; // When true, the sage won't be displayed $config['hide_sage'] = false; From ecdc53522fd7627788c9088784282230da4d4960 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:21:30 -0800 Subject: [PATCH 12/50] New event: rebuildpost, allows you to bind events to ?/edit --- inc/functions.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index afb7d522..85c02ef1 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1050,19 +1050,22 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) { // rebuild post (markup) function rebuildPost($id) { - global $board; + global $board, $mod; - $query = prepare(sprintf("SELECT `body_nomarkup`, `thread` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); if ((!$post = $query->fetch(PDO::FETCH_ASSOC)) || !$post['body_nomarkup']) return false; - markup($body = &$post['body_nomarkup']); + markup($post['body'] = &$post['body_nomarkup']); + $post = (object)$post; + event('rebuildpost', $post); + $post = (array)$post; $query = prepare(sprintf("UPDATE ``posts_%s`` SET `body` = :body WHERE `id` = :id", $board['uri'])); - $query->bindValue(':body', $body); + $query->bindValue(':body', $post['body']); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); From ee635db05fdbe7bc6abbb525848d07a164ae6a17 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:24:11 -0800 Subject: [PATCH 13/50] new checkDNSBL() function, return true/false, not error --- inc/functions.php | 43 ++++++++++++++++++++++++++----------------- post.php | 4 ++-- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 85c02ef1..f199372e 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1583,20 +1583,22 @@ function buildJavascript() { file_write($config['file_script'], $script); } -function checkDNSBL() { +function checkDNSBL($use_ip = false) { global $config; - - if (isIPv6()) - return; // No IPv6 support yet. - - if (!isset($_SERVER['REMOTE_ADDR'])) + if (!$use_ip && !isset($_SERVER['REMOTE_ADDR'])) return; // Fix your web server configuration - if (in_array($_SERVER['REMOTE_ADDR'], $config['dnsbl_exceptions'])) + $ip = ($use_ip ? $use_ip : $_SERVER['REMOTE_ADDR']); + if ($ip == '127.0.0.2') return true; + + if (isIPv6($ip)) + return; // No IPv6 support yet. + + if (in_array($ip, $config['dnsbl_exceptions'])) return; - $ipaddr = ReverseIPOctets($_SERVER['REMOTE_ADDR']); + $ipaddr = ReverseIPOctets($ip); foreach ($config['dnsbl'] as $blacklist) { if (!is_array($blacklist)) @@ -1612,24 +1614,31 @@ function checkDNSBL() { if (!isset($blacklist[1])) { // If you're listed at all, you're blocked. - error(sprintf($config['error']['dnsbl'], $blacklist_name)); + if ($use_ip) { + return true; + } else { + error(sprintf($config['error']['dnsbl'], $blacklist_name)); + } } elseif (is_array($blacklist[1])) { foreach ($blacklist[1] as $octet) { - if ($ip == $octet || $ip == '127.0.0.' . $octet) - error(sprintf($config['error']['dnsbl'], $blacklist_name)); + if ($ip == $octet || $ip == '127.0.0.' . $octet) { + return true; + } } } elseif (is_callable($blacklist[1])) { - if ($blacklist[1]($ip)) - error(sprintf($config['error']['dnsbl'], $blacklist_name)); + if ($blacklist[1]($ip)) { + return true; + } } else { - if ($ip == $blacklist[1] || $ip == '127.0.0.' . $blacklist[1]) - error(sprintf($config['error']['dnsbl'], $blacklist_name)); + if ($ip == $blacklist[1] || $ip == '127.0.0.' . $blacklist[1]) { + return true; + } } } } -function isIPv6() { - return strstr($_SERVER['REMOTE_ADDR'], ':') !== false; +function isIPv6($ip = false) { + return strstr(($ip ? $ip : $_SERVER['REMOTE_ADDR']), ':') !== false; } function ReverseIPOctets($ip) { diff --git a/post.php b/post.php index bb690b85..ef7f2058 100644 --- a/post.php +++ b/post.php @@ -38,7 +38,7 @@ if (isset($_POST['delete'])) { } } - checkDNSBL(); + if (checkDNSBL()) error("Tor users may not delete posts."); // Check if board exists if (!openBoard($_POST['board'])) @@ -116,7 +116,7 @@ elseif (isset($_POST['report'])) { } } - checkDNSBL(); + if (checkDNSBL()) error("Tor users may not report posts."); // Check if board exists if (!openBoard($_POST['board'])) From 15987f919fa76c6429abecd7daee18e367ccc49a Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:24:54 -0800 Subject: [PATCH 14/50] Fix *0 secure tripcodes caused by accidentally feeding + signs to crypt() --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index f199372e..69856c3e 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -2228,7 +2228,7 @@ function generate_tripcode($name) { if (isset($config['custom_tripcode']["##{$trip}"])) $trip = $config['custom_tripcode']["##{$trip}"]; else - $trip = '!!' . substr(crypt($trip, '_..A.' . substr(base64_encode(sha1($trip . $config['secure_trip_salt'], true)), 0, 4)), -10); + $trip = '!!' . substr(crypt($trip, str_replace('+', '.', '_..A.' . substr(base64_encode(sha1($trip . $config['secure_trip_salt'], true)), 0, 4))), -10); } else { if (isset($config['custom_tripcode']["#{$trip}"])) $trip = $config['custom_tripcode']["#{$trip}"]; From 9c1a90aa263e45f8eae84754f00a5b904ede1cd2 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:25:39 -0800 Subject: [PATCH 15/50] Move top board exceptions completely to boards.php --- js/update_boards.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/js/update_boards.js b/js/update_boards.js index 356d6259..00de5397 100644 --- a/js/update_boards.js +++ b/js/update_boards.js @@ -24,9 +24,7 @@ if (window.Options && Options.get_tab('general')) { function handle_boards(data) { $.each(data, function(k, v) { - if (v.uri != 'meta' && v.uri != 'b') { - boards.push(''+v.uri+''); - } + boards.push(''+v.uri+''); }) if (boards[0]) { From fb800497f18bf5aad7aba128e94b0b719b8f031a Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:26:20 -0800 Subject: [PATCH 16/50] /meta/ -> /operate --- inc/instance-config.php | 2 +- templates/8chan/index.html | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index fba06740..ac8d3689 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -156,7 +156,7 @@ $config['markup'][] = array("/__(.+?)__/", "\$1"); $config['markup'][] = array("/###([^\s']+)###/", "###\$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', 'news+'), array(''=>'https://twitter.com/infinitechan')); + $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', 'operate', 'news+', 'boards'), 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'][] = 'All posts on 8chan are the responsibility of the individual poster and not the administration of 8chan, pursuant to 47 U.S.C. § 230.'; diff --git a/templates/8chan/index.html b/templates/8chan/index.html index 96bbd078..5e8b1f1f 100644 --- a/templates/8chan/index.html +++ b/templates/8chan/index.html @@ -235,7 +235,7 @@
    {% trans %}Welcome to 8chan, the infinitely expanding imageboard.{% endtrans %}
    - [ /b/ - Random | /meta/ - Help & Support | /news+/ - News ] + [ /b/ - Random | /news+/ - News | /boards/ - Boards]
    {% trans %}Top 25 boards:{% endtrans %} @@ -261,7 +261,7 @@
    - + +
    From c7f26b31c1c754f154fb4a8a83891742c236bcd8 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:28:22 -0800 Subject: [PATCH 17/50] board_log function, ?/log:b:test --- inc/mod/pages.php | 27 +++++++++++++++++++++++++++ mod.php | 6 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 93e076f9..2bb0e52c 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -669,6 +669,33 @@ function mod_user_log($username, $page_no = 1) { mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username)); } +function mod_board_log($board, $page_no = 1) { + global $config; + + if ($page_no < 1) + error($config['error']['404']); + + if (!hasPermission($config['mod']['modlog'])) + error($config['error']['noaccess']); + + $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `board` = :board ORDER BY `time` DESC LIMIT :offset, :limit"); + $query->bindValue(':board', $board); + $query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT); + $query->bindValue(':offset', ($page_no - 1) * $config['mod']['modlog_page'], PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + $logs = $query->fetchAll(PDO::FETCH_ASSOC); + + if (empty($logs) && $page_no > 1) + error($config['error']['404']); + + $query = prepare("SELECT COUNT(*) FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `board` = :board"); + $query->bindValue(':board', $board); + $query->execute() or error(db_error($query)); + $count = $query->fetchColumn(); + + mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'board' => $board)); +} + function mod_view_board($boardName, $page_no = 1) { global $config, $mod; diff --git a/mod.php b/mod.php index a8bd9b77..53694fcc 100644 --- a/mod.php +++ b/mod.php @@ -29,8 +29,10 @@ $pages = array( '/log' => 'log', // modlog '/log/(\d+)' => 'log', // modlog - '/log:([^/]+)' => 'user_log', // modlog - '/log:([^/]+)/(\d+)' => 'user_log', // modlog + '/log:([^/:]+)' => 'user_log', // modlog + '/log:([^/:]+)/(\d+)' => 'user_log', // modlog + '/log:b:([^/]+)' => 'board_log', // modlog + '/log:b:([^/]+)/(\d+)' => 'board_log', // modlog '/edit_news' => 'secure_POST news', // view news '/edit_news/(\d+)' => 'secure_POST news', // view news '/edit_news/delete/(\d+)' => 'secure news_delete', // delete from news From bba836825471c108ce294fd4b3d6b1609f5cf9e4 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:28:56 -0800 Subject: [PATCH 18/50] Catalog scroll bars --- stylesheets/style.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index bd899756..ae123573 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -578,7 +578,7 @@ table.mod.config-editor input[type="text"] { width: 98%; } -.desktop-style div.boardlist:nth-child(1) { +.desktop-style div.boardlist:not(.bottom) { position: fixed; top: 0; left: 0; @@ -1017,6 +1017,9 @@ span.pln { div.mix { display: inline-block; } +.theme-catalog div.thread:hover { + overflow-y: auto; width: 100% +} /* Mona Font */ From b015fc13234f800fe0da906221e6335849403959 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:29:35 -0800 Subject: [PATCH 19/50] Just show deleted if first file deleted --- templates/themes/catalog/theme.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index dc58fff2..a5491a7c 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -59,17 +59,7 @@ if ($files[0]) { if ($files[0]->file == 'deleted') { - if (count($files) > 1) { - foreach ($files as $file) { - if (($file == $files[0]) || ($file->file == 'deleted')) continue; - $post['file'] = $config['uri_thumb'] . $file->thumb; - } - - if (empty($post['file'])) $post['file'] = $config['image_deleted']; - } - else { - $post['file'] = $config['image_deleted']; - } + $post['file'] = $config['image_deleted']; } else if($files[0]->thumb == 'spoiler') { $post['file'] = '/' . $config['spoiler_image']; From f67bbd4b62efe0d510359adbee2af32e8489754f Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:31:15 -0800 Subject: [PATCH 20/50] OpenGraph information in thread pages https://en.wikipedia.org/wiki/Facebook_Platform#Open_Graph_protocol --- templates/thread.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/templates/thread.html b/templates/thread.html index 0785f7fe..241d9f36 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -8,7 +8,18 @@ {% include 'header.html' %} - {{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ thread.body_nomarkup[:256]|e }}{% endif %} + + {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup[:256]|e }}{% endif %}{% endset %} + + + + + + + {% if thread.files.0.thumb %}{% endif %} + + + {{ board.url }} - {{ meta_subject }} {{ boardlist.top }} From eb6855ca8bfefe3a4188646f3d96417177f91ded Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 16 Feb 2015 16:33:13 -0800 Subject: [PATCH 21/50] New templates: ad_top and ad_bottom. Make blank pages if you're not using them --- 404.php | 3 +++ templates/index.html | 8 ++++++-- templates/themes/catalog/catalog.html | 4 +++- templates/thread.html | 8 ++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/404.php b/404.php index b660857f..e74eb65b 100644 --- a/404.php +++ b/404.php @@ -32,7 +32,10 @@ if (preg_match('!'.$config['board_regex'].'/'.$config['dir']['res'].'\d+\.html!u $return_link = ''; } +$ad = Element("ad_top.html", array()); + $page = <<$ad

    [ Home ]{$return_link}

    diff --git a/templates/index.html b/templates/index.html index e422b8bc..2af65bf8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -37,7 +37,9 @@ {% include 'attention_bar.html' %} - {{ config.ad.top }} + {% if board.uri not in config.banned_ad_boards %} + {% include 'ad_top.html' %} + {% endif %} {% if not no_post_form %} {% include 'post_form.html' %} @@ -74,7 +76,9 @@ {{ boardlist.bottom }} - {{ config.ad.bottom }} + {% if board.uri not in config.banned_ad_boards %} + {% include 'ad_bottom.html' %} + {% endif %}