From 1495e90748f1389c1e565390281e889a07beb073 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 23 Sep 2014 19:52:06 -0700 Subject: [PATCH 01/39] inline --- js/inline.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 js/inline.js diff --git a/js/inline.js b/js/inline.js new file mode 100644 index 00000000..1130c68b --- /dev/null +++ b/js/inline.js @@ -0,0 +1,34 @@ +;(function() { + $('.body a').click(inline) + + $('head').append( + '') +})() + +function inline(e) { + e.preventDefault() + var postNum = parseInt(this.textContent.slice(2)) + + var cloneID = 'inline_' + postNum + var $clone = $('#' + cloneID) + if ($clone.length) + return $clone.remove() + + var OP = location.pathname.match(/(\d+).html/)[1] + var selector = postNum === OP + ? '.op .body' + : '#reply_' + postNum + ' .body' + + $clone = $(selector).clone(true) + $clone.attr({ + className: 'inline', + id: cloneID + }) + $clone.insertAfter(this) +} From a7820579eb734b4ec3dbd000f9e0cf482c96de75 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 23 Sep 2014 21:25:34 -0700 Subject: [PATCH 02/39] maybe support cross thread inlining --- js/inline.js | 62 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/js/inline.js b/js/inline.js index 1130c68b..6b373dce 100644 --- a/js/inline.js +++ b/js/inline.js @@ -1,5 +1,40 @@ ;(function() { - $('.body a').click(inline) + var inline = function(e) { + e.preventDefault() + + var postNum = this.textContent.slice(2) + + var $clone = $('#inline_' + postNum) + if ($clone.length) + return $clone.remove() + + var OP = location.pathname.match(/(\d+).html/)[1] + var selector = postNum === OP + ? '.op .body' + : '#reply_' + postNum + ' .body' + + var link = { + postNum: postNum, + node: this + } + var $target = $(selector) + if ($target.length) + add(link, $target) + else + $.get(this.pathname, function(data) { + var $target = $(data).find(selector) + add(link, $target) + }) + } + + var add = function(link, $target) { + var $clone = $target.clone(true) + $clone.attr({ + "class": 'inline', + id: 'inline_' + link.postNum + }) + $clone.insertAfter(link.node) + } $('head').append( '') + + $('.body a').click(inline) + })() - -function inline(e) { - e.preventDefault() - var postNum = parseInt(this.textContent.slice(2)) - - var cloneID = 'inline_' + postNum - var $clone = $('#' + cloneID) - if ($clone.length) - return $clone.remove() - - var OP = location.pathname.match(/(\d+).html/)[1] - var selector = postNum === OP - ? '.op .body' - : '#reply_' + postNum + ' .body' - - $clone = $(selector).clone(true) - $clone.attr({ - className: 'inline', - id: cloneID - }) - $clone.insertAfter(this) -} From cdae08027cc2c3cede47a8aced80ea70287cf51b Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 23 Sep 2014 21:40:32 -0700 Subject: [PATCH 03/39] get op from input value --- js/inline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/inline.js b/js/inline.js index 6b373dce..863aefbb 100644 --- a/js/inline.js +++ b/js/inline.js @@ -8,7 +8,7 @@ if ($clone.length) return $clone.remove() - var OP = location.pathname.match(/(\d+).html/)[1] + var OP = $('input[name="thread"]').val() var selector = postNum === OP ? '.op .body' : '#reply_' + postNum + ' .body' From c38148c8a50670912808314ae385bc2bb8c1a258 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 24 Sep 2014 12:17:30 -0700 Subject: [PATCH 04/39] fix cross-thread inlining --- js/inline.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/inline.js b/js/inline.js index 863aefbb..6334e60e 100644 --- a/js/inline.js +++ b/js/inline.js @@ -8,8 +8,8 @@ if ($clone.length) return $clone.remove() - var OP = $('input[name="thread"]').val() - var selector = postNum === OP + var postOP = this.pathname.match(/(\d+).html/)[1] + var selector = postNum === postOP ? '.op .body' : '#reply_' + postNum + ' .body' @@ -17,9 +17,12 @@ postNum: postNum, node: this } - var $target = $(selector) - if ($target.length) + + var OP = $('input[name="thread"]').val() + if (OP === postOP) { + var $target = $(selector) add(link, $target) + } else $.get(this.pathname, function(data) { var $target = $(data).find(selector) From 08341b6d72e74c207e4b52e57a4c8e954bee2f4d Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 24 Sep 2014 12:37:25 -0700 Subject: [PATCH 05/39] fix selector --- js/inline.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/inline.js b/js/inline.js index 6334e60e..e93df2b6 100644 --- a/js/inline.js +++ b/js/inline.js @@ -20,6 +20,8 @@ var OP = $('input[name="thread"]').val() if (OP === postOP) { + // XXX WTF the post hover script adds fetched threads to the DOM + selector = '#thread_' + OP + ' ' + selector var $target = $(selector) add(link, $target) } From 38a9d323fe26ba7eb449e98a2a35add6cb1f8949 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 24 Sep 2014 12:49:18 -0700 Subject: [PATCH 06/39] this is how you cache --- js/inline.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/inline.js b/js/inline.js index e93df2b6..8a2b6614 100644 --- a/js/inline.js +++ b/js/inline.js @@ -1,4 +1,6 @@ ;(function() { + var cache = {} + var inline = function(e) { e.preventDefault() @@ -23,13 +25,21 @@ // XXX WTF the post hover script adds fetched threads to the DOM selector = '#thread_' + OP + ' ' + selector var $target = $(selector) - add(link, $target) + return add(link, $target) } - else - $.get(this.pathname, function(data) { - var $target = $(data).find(selector) - add(link, $target) - }) + + var url = this.pathname + var data = cache[url] + if (data) { + var $target = $(data).find(selector) + return add(link, $target) + } + + $.get(url, function(data) { + cache[url] = data + var $target = $(data).find(selector) + add(link, $target) + }) } var add = function(link, $target) { From 4133a7b9686fc8f158f805bc7805c8787857f02a Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 25 Sep 2014 09:58:44 -0700 Subject: [PATCH 07/39] disable highlightReply --- js/inline.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/inline.js b/js/inline.js index 8a2b6614..728a887a 100644 --- a/js/inline.js +++ b/js/inline.js @@ -60,6 +60,8 @@ '}' + '') - $('.body a').click(inline) + $('.body a') + .attr('onclick', null)// disable highlightReply. so hacky + .click(inline) })() From bc054b14d01b6d3f0e3dcbae90f39fed0236ddf6 Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 25 Sep 2014 10:11:33 -0700 Subject: [PATCH 08/39] work for backlinks --- js/inline.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/inline.js b/js/inline.js index 728a887a..df91c8a9 100644 --- a/js/inline.js +++ b/js/inline.js @@ -4,9 +4,10 @@ var inline = function(e) { e.preventDefault() + var $root = $(this).closest('.post') var postNum = this.textContent.slice(2) - var $clone = $('#inline_' + postNum) + var $clone = $root.find('#inline_' + postNum) if ($clone.length) return $clone.remove() @@ -15,9 +16,13 @@ ? '.op .body' : '#reply_' + postNum + ' .body' + var node = this.className + ? $root.find('.body').first().children().first() + : this.nextSibling + var link = { - postNum: postNum, - node: this + node: node, + postNum: postNum } var OP = $('input[name="thread"]').val() @@ -48,7 +53,7 @@ "class": 'inline', id: 'inline_' + link.postNum }) - $clone.insertAfter(link.node) + $clone.insertBefore(link.node) } $('head').append( @@ -60,7 +65,7 @@ '}' + '') - $('.body a') + $('.body a, .mentioned a') .attr('onclick', null)// disable highlightReply. so hacky .click(inline) From b621699a22463fd9f47e0d1f5c9d366b1e2ab6ed Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 13:19:39 -0700 Subject: [PATCH 09/39] Update instance-config.php @ctrlcctrlv said to me over IRC he removed the threadscroll script because on some browsers, it would refresh the page when scrolling. This has been fixed in #98, so it should be back in as a default addditional JS. and i remembered the semicolon this time --- inc/instance-config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/instance-config.php b/inc/instance-config.php index d74b97fd..2501e20f 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -122,6 +122,7 @@ $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/threadscroll.js'; $config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'; From 7f42b2e9f6dd72da998712b6351befbdd5adc676 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 09:17:19 -0700 Subject: [PATCH 10/39] fix --- js/inline.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/inline.js b/js/inline.js index df91c8a9..ff897ca3 100644 --- a/js/inline.js +++ b/js/inline.js @@ -17,7 +17,8 @@ : '#reply_' + postNum + ' .body' var node = this.className - ? $root.find('.body').first().children().first() + // XXX post hover element is added to the quoting post + ? $root.find('> .body, > .inline').first() : this.nextSibling var link = { @@ -27,7 +28,7 @@ var OP = $('input[name="thread"]').val() if (OP === postOP) { - // XXX WTF the post hover script adds fetched threads to the DOM + // XXX post hover adds fetched threads to the DOM selector = '#thread_' + OP + ' ' + selector var $target = $(selector) return add(link, $target) @@ -66,7 +67,6 @@ '') $('.body a, .mentioned a') - .attr('onclick', null)// disable highlightReply. so hacky + .attr('onclick', null)// XXX disable highlightReply .click(inline) - })() From 6b2733feb52801ecfd64bbd61f9117076f4f4f3b Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 09:53:11 -0700 Subject: [PATCH 11/39] grab the whole post --- js/inline.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/inline.js b/js/inline.js index ff897ca3..55389f36 100644 --- a/js/inline.js +++ b/js/inline.js @@ -14,7 +14,7 @@ var postOP = this.pathname.match(/(\d+).html/)[1] var selector = postNum === postOP ? '.op .body' - : '#reply_' + postNum + ' .body' + : '#reply_' + postNum var node = this.className // XXX post hover element is added to the quoting post @@ -51,7 +51,7 @@ var add = function(link, $target) { var $clone = $target.clone(true) $clone.attr({ - "class": 'inline', + "class": 'inline post', id: 'inline_' + link.postNum }) $clone.insertBefore(link.node) @@ -59,11 +59,8 @@ $('head').append( '') $('.body a, .mentioned a') From eef2f09fb4ac075c395ace55d25ea9ac9aac1f15 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 10:00:44 -0700 Subject: [PATCH 12/39] fix for image posts --- js/inline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/inline.js b/js/inline.js index 55389f36..fd445a7a 100644 --- a/js/inline.js +++ b/js/inline.js @@ -18,7 +18,7 @@ var node = this.className // XXX post hover element is added to the quoting post - ? $root.find('> .body, > .inline').first() + ? $root.find('> .files, > .inline').first() : this.nextSibling var link = { From c7345d12cca218b0efb678ec795e4afce0b873cb Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 10:03:31 -0700 Subject: [PATCH 13/39] less invasive css fix --- js/inline.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/inline.js b/js/inline.js index fd445a7a..3eac588e 100644 --- a/js/inline.js +++ b/js/inline.js @@ -59,8 +59,7 @@ $('head').append( '') $('.body a, .mentioned a') From acd66b608ee2636c362a35b00bf325dbe923a6b1 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:05:45 -0700 Subject: [PATCH 14/39] fix when quote is last element --- js/inline.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/inline.js b/js/inline.js index 3eac588e..26b13f91 100644 --- a/js/inline.js +++ b/js/inline.js @@ -17,9 +17,8 @@ : '#reply_' + postNum var node = this.className - // XXX post hover element is added to the quoting post - ? $root.find('> .files, > .inline').first() - : this.nextSibling + ? $root.find('> .intro') + : this var link = { node: node, @@ -54,7 +53,7 @@ "class": 'inline post', id: 'inline_' + link.postNum }) - $clone.insertBefore(link.node) + $clone.insertAfter(link.node) } $('head').append( From a38fa1bf75326df2f63628e5a845e5064bbf7da4 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:08:50 -0700 Subject: [PATCH 15/39] bypass (OP) text --- js/inline.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/inline.js b/js/inline.js index 26b13f91..0ea7f233 100644 --- a/js/inline.js +++ b/js/inline.js @@ -18,7 +18,7 @@ var node = this.className ? $root.find('> .intro') - : this + : $(this) var link = { node: node, @@ -29,6 +29,8 @@ if (OP === postOP) { // XXX post hover adds fetched threads to the DOM selector = '#thread_' + OP + ' ' + selector + // XXX bypass the `(OP)` text + link.node = link.node.next() var $target = $(selector) return add(link, $target) } From 09684c54507d63d0d2fb7fcfcc5a58d615d98c7a Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:28:52 -0700 Subject: [PATCH 16/39] front page fixes --- js/inline.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/inline.js b/js/inline.js index 0ea7f233..622d40b3 100644 --- a/js/inline.js +++ b/js/inline.js @@ -25,14 +25,16 @@ postNum: postNum } - var OP = $('input[name="thread"]').val() - if (OP === postOP) { + var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] + if (srcOP === postOP) { // XXX post hover adds fetched threads to the DOM - selector = '#thread_' + OP + ' ' + selector + selector = '#thread_' + srcOP + ' ' + selector // XXX bypass the `(OP)` text link.node = link.node.next() + var $target = $(selector) - return add(link, $target) + if ($target.length) + return add(link, $target) } var url = this.pathname @@ -53,7 +55,8 @@ var $clone = $target.clone(true) $clone.attr({ "class": 'inline post', - id: 'inline_' + link.postNum + id: 'inline_' + link.postNum, + style: null// XXX remove post hover styling }) $clone.insertAfter(link.node) } From 241eb0c6c7f1fabdbd546bdeae877b64fd35d858 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:32:41 -0700 Subject: [PATCH 17/39] rename --- js/inline.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/inline.js b/js/inline.js index 622d40b3..fb50684b 100644 --- a/js/inline.js +++ b/js/inline.js @@ -5,16 +5,16 @@ e.preventDefault() var $root = $(this).closest('.post') - var postNum = this.textContent.slice(2) + var targetNum = this.textContent.slice(2) - var $clone = $root.find('#inline_' + postNum) + var $clone = $root.find('#inline_' + targetNum) if ($clone.length) return $clone.remove() - var postOP = this.pathname.match(/(\d+).html/)[1] - var selector = postNum === postOP + var targetOP = this.pathname.match(/(\d+).html/)[1] + var selector = targetNum === targetOP ? '.op .body' - : '#reply_' + postNum + : '#reply_' + targetNum var node = this.className ? $root.find('> .intro') @@ -22,11 +22,11 @@ var link = { node: node, - postNum: postNum + targetNum: targetNum } var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] - if (srcOP === postOP) { + if (srcOP === targetOP) { // XXX post hover adds fetched threads to the DOM selector = '#thread_' + srcOP + ' ' + selector // XXX bypass the `(OP)` text @@ -55,7 +55,7 @@ var $clone = $target.clone(true) $clone.attr({ "class": 'inline post', - id: 'inline_' + link.postNum, + id: 'inline_' + link.targetNum, style: null// XXX remove post hover styling }) $clone.insertAfter(link.node) From b17a81dece966efbdf83d44e2fa1e534375796eb Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:40:05 -0700 Subject: [PATCH 18/39] fix front page backlink --- js/inline.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/js/inline.js b/js/inline.js index fb50684b..2b5200fc 100644 --- a/js/inline.js +++ b/js/inline.js @@ -11,21 +11,26 @@ if ($clone.length) return $clone.remove() - var targetOP = this.pathname.match(/(\d+).html/)[1] - var selector = targetNum === targetOP - ? '.op .body' - : '#reply_' + targetNum + var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] - var node = this.className - ? $root.find('> .intro') - : $(this) + var node, targetOP + if (this.className) {// backlink + node = $root.find('> .intro') + targetOP = srcOP + } else { + node = $(this) + targetOP = this.pathname.match(/(\d+).html/)[1] + } var link = { node: node, targetNum: targetNum } - var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] + var selector = targetNum === targetOP + ? '.op .body' + : '#reply_' + targetNum + if (srcOP === targetOP) { // XXX post hover adds fetched threads to the DOM selector = '#thread_' + srcOP + ' ' + selector From 29c887f99ddb801d671a7c86c298ec880afe6589 Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:41:54 -0700 Subject: [PATCH 19/39] remove inlined posts for new inlined posts --- js/inline.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/inline.js b/js/inline.js index 2b5200fc..a0b80649 100644 --- a/js/inline.js +++ b/js/inline.js @@ -58,6 +58,7 @@ var add = function(link, $target) { var $clone = $target.clone(true) + $clone.find('.inline').remove() $clone.attr({ "class": 'inline post', id: 'inline_' + link.targetNum, From e7e057c8c87b93069347e197be2467b423c72cce Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 4 Oct 2014 06:48:29 -0700 Subject: [PATCH 20/39] clearfix --- js/inline.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/inline.js b/js/inline.js index a0b80649..0b7a47a0 100644 --- a/js/inline.js +++ b/js/inline.js @@ -69,7 +69,11 @@ $('head').append( '') $('.body a, .mentioned a') From bbc4169eaa6fd9c4a340f26bac49f8e6fa1c7d87 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 4 Oct 2014 08:16:01 -0700 Subject: [PATCH 21/39] fix --- js/inline.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/inline.js b/js/inline.js index 0b7a47a0..b83a5ae6 100644 --- a/js/inline.js +++ b/js/inline.js @@ -34,8 +34,10 @@ if (srcOP === targetOP) { // XXX post hover adds fetched threads to the DOM selector = '#thread_' + srcOP + ' ' + selector - // XXX bypass the `(OP)` text - link.node = link.node.next() + + // bypass `(OP)` + if (targetNum === targetOP) + link.node = link.node.next() var $target = $(selector) if ($target.length) From 53cc67ba2d64ab7d53a0c1dd01401f78bb9a17bc Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Oct 2014 07:19:14 -0700 Subject: [PATCH 22/39] better op selector, don't attach to links --- js/inline.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/inline.js b/js/inline.js index b83a5ae6..9232fa63 100644 --- a/js/inline.js +++ b/js/inline.js @@ -28,16 +28,12 @@ } var selector = targetNum === targetOP - ? '.op .body' + ? '#op_' + srcOP : '#reply_' + targetNum if (srcOP === targetOP) { - // XXX post hover adds fetched threads to the DOM - selector = '#thread_' + srcOP + ' ' + selector - - // bypass `(OP)` if (targetNum === targetOP) - link.node = link.node.next() + link.node = link.node.next()// bypass `(OP)` var $target = $(selector) if ($target.length) @@ -78,7 +74,8 @@ '}' + '') - $('.body a, .mentioned a') + // don't attach to outbound links + $('.body a:not([rel]), .mentioned a') .attr('onclick', null)// XXX disable highlightReply .click(inline) })() From 98b172980f5b00ae605096f0c327b67d87d716c8 Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 03:37:13 +0900 Subject: [PATCH 23/39] add forward-confirmed reverse DNS --- inc/config.php | 5 ++++- inc/functions.php | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index ac4069da..c96e9e4e 100644 --- a/inc/config.php +++ b/inc/config.php @@ -66,7 +66,10 @@ // Use `host` via shell_exec() to lookup hostnames, avoiding query timeouts. May not work on your system. // Requires safe_mode to be disabled. $config['dns_system'] = false; - + + // Check validity of the reverse DNS of IP addresses. Highly recommended. + $config['fcrdns'] = true; + // When executing most command-line tools (such as `convert` for ImageMagick image processing), add this // to the environment path (seperated by :). $config['shell_path'] = '/usr/local/bin'; diff --git a/inc/functions.php b/inc/functions.php index f9c09085..5960d65d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2259,6 +2259,7 @@ function rDNS($ip_addr) { if (!$config['dns_system']) { $host = gethostbyaddr($ip_addr); + $isip = filter_var($host, FILTER_VALIDATE_IP); } else { $resp = shell_exec_error('host -W 1 ' . $ip_addr); if (preg_match('/domain name pointer ([^\s]+)$/', $resp, $m)) @@ -2267,6 +2268,10 @@ function rDNS($ip_addr) { $host = $ip_addr; } + if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { + $host = $ip_addr; + } + if ($config['cache']['enabled']) cache::set('rdns_' . $ip_addr, $host); From ca7955ecfc661d8684ba32c2b093b8298aa4daa3 Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 04:08:10 +0900 Subject: [PATCH 24/39] don't break if dns_system is true --- inc/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 5960d65d..be20d034 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2259,7 +2259,6 @@ function rDNS($ip_addr) { if (!$config['dns_system']) { $host = gethostbyaddr($ip_addr); - $isip = filter_var($host, FILTER_VALIDATE_IP); } else { $resp = shell_exec_error('host -W 1 ' . $ip_addr); if (preg_match('/domain name pointer ([^\s]+)$/', $resp, $m)) @@ -2268,6 +2267,8 @@ function rDNS($ip_addr) { $host = $ip_addr; } + $isip = filter_var($host, FILTER_VALIDATE_IP); + if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { $host = $ip_addr; } From 3f4381cf402adc9c0bffbc5b57509fba91b3bd8d Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 04:30:32 +0900 Subject: [PATCH 25/39] wasn't aware of DNS function --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index be20d034..686a7e22 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2269,7 +2269,7 @@ function rDNS($ip_addr) { $isip = filter_var($host, FILTER_VALIDATE_IP); - if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { + if ($config['fcrdns'] && !$isip && DNS($host) != $ip_addr) { $host = $ip_addr; } From 944c3b6c284bee9832d4a79763fc49103713d661 Mon Sep 17 00:00:00 2001 From: kaernyk Date: Sun, 5 Oct 2014 15:40:42 -0400 Subject: [PATCH 26/39] Fix post width & codeblocks I noticed that some url's were causing the posts to stretch over the maximum device with. The code blocks were exhibiting similar behavior as well, and have been adjusted to display well on all themes. I still need to fix the post form for handhelds, though it is not as annoying as the other things fixed --- stylesheets/style.css | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index bdac756a..b72056cb 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -289,6 +289,7 @@ div.post.reply { border-style: none solid solid none; border-color: #B7C5D9; display: inline-block; + max-width: 94%!important; } span.trip { @@ -892,16 +893,21 @@ div.thread:hover { cursor: pointer; } -code > pre { +pre { /* Better code tags */ - background:black; max-width:inherit; + word-wrap:normal; + overflow:auto; + display: block!important; + font-size:9pt; + font-family:monospace; } -code > pre > span.pln { - color: grey; +span.pln { + color:grey; } + @media screen and (min-width: 768px) { p.intro { clear: none; From 6804a2ede07438ba1bac922a9a6a914c30651127 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 5 Oct 2014 22:16:36 +0200 Subject: [PATCH 27/39] remove default margin for table elements; fixes vichan-devel#95 --- stylesheets/style.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index b72056cb..30172427 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -8,10 +8,6 @@ body { padding-right: 4px; } -table * { - margin: 1px; -} - a,a:visited { text-decoration: underline; color: #34345C; From 8b9932218ffa0e53b05cad5bc769f9317687e6da Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 03:37:13 +0900 Subject: [PATCH 28/39] add forward-confirmed reverse DNS --- inc/config.php | 5 ++++- inc/functions.php | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 1a75cad0..bd5c5db3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -66,7 +66,10 @@ // Use `host` via shell_exec() to lookup hostnames, avoiding query timeouts. May not work on your system. // Requires safe_mode to be disabled. $config['dns_system'] = false; - + + // Check validity of the reverse DNS of IP addresses. Highly recommended. + $config['fcrdns'] = true; + // When executing most command-line tools (such as `convert` for ImageMagick image processing), add this // to the environment path (seperated by :). $config['shell_path'] = '/usr/local/bin'; diff --git a/inc/functions.php b/inc/functions.php index 357666d6..8c5f46b9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2265,6 +2265,7 @@ function rDNS($ip_addr) { if (!$config['dns_system']) { $host = gethostbyaddr($ip_addr); + $isip = filter_var($host, FILTER_VALIDATE_IP); } else { $resp = shell_exec_error('host -W 1 ' . $ip_addr); if (preg_match('/domain name pointer ([^\s]+)$/', $resp, $m)) @@ -2273,6 +2274,10 @@ function rDNS($ip_addr) { $host = $ip_addr; } + if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { + $host = $ip_addr; + } + if ($config['cache']['enabled']) cache::set('rdns_' . $ip_addr, $host); From 1e95e588110516ed0d89ddb8546548a6324b3e1a Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 04:08:10 +0900 Subject: [PATCH 29/39] don't break if dns_system is true --- inc/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 8c5f46b9..f45e9055 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2265,7 +2265,6 @@ function rDNS($ip_addr) { if (!$config['dns_system']) { $host = gethostbyaddr($ip_addr); - $isip = filter_var($host, FILTER_VALIDATE_IP); } else { $resp = shell_exec_error('host -W 1 ' . $ip_addr); if (preg_match('/domain name pointer ([^\s]+)$/', $resp, $m)) @@ -2274,6 +2273,8 @@ function rDNS($ip_addr) { $host = $ip_addr; } + $isip = filter_var($host, FILTER_VALIDATE_IP); + if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { $host = $ip_addr; } From aba8d27ace9b1b95bb7cc71ae0424f0bc8f20809 Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Oct 2014 04:30:32 +0900 Subject: [PATCH 30/39] wasn't aware of DNS function --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index f45e9055..3802d19d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2275,7 +2275,7 @@ function rDNS($ip_addr) { $isip = filter_var($host, FILTER_VALIDATE_IP); - if ($config['fcrdns'] && !$isip && gethostbyname($host) != $ip_addr) { + if ($config['fcrdns'] && !$isip && DNS($host) != $ip_addr) { $host = $ip_addr; } From 68d138fa6ca6d9690441dde1ccb1f234a10ce03b Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Oct 2014 15:51:22 -0700 Subject: [PATCH 31/39] extract caching --- js/inline.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/js/inline.js b/js/inline.js index 9232fa63..bcbf156f 100644 --- a/js/inline.js +++ b/js/inline.js @@ -1,5 +1,18 @@ ;(function() { - var cache = {} + var App = { + cache: {}, + get: function(url, cb) { + var $page = App.cache[url] + if ($page) + return cb($page) + + $.get(url, function(data) { + var $page = $(data) + App.cache[url] = $page + cb($page) + }) + } + } var inline = function(e) { e.preventDefault() @@ -40,16 +53,8 @@ return add(link, $target) } - var url = this.pathname - var data = cache[url] - if (data) { - var $target = $(data).find(selector) - return add(link, $target) - } - - $.get(url, function(data) { - cache[url] = data - var $target = $(data).find(selector) + App.get(this.pathname, function($page) { + var $target = $page.find(selector) add(link, $target) }) } From 4119442877a7e7c6886e39edc2e3a9d8be35506c Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Oct 2014 16:20:25 -0700 Subject: [PATCH 32/39] optional --- js/inline.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/js/inline.js b/js/inline.js index bcbf156f..5399e871 100644 --- a/js/inline.js +++ b/js/inline.js @@ -11,6 +11,37 @@ App.cache[url] = $page cb($page) }) + }, + options: { + add: function(key, description, tab) { + tab || (tab = 'general') + + var checked = App.options.get(key) + var $el = $( + '
' + + '' + + '
') + + $el + .find('input') + .prop('checked', checked) + .on('change', App.options.check(key)) + + window.Options.extend_tab(tab, $el) + }, + get: function(key) { + if (localStorage[key]) + return JSON.parse(localStorage[key]) + }, + check: function(key) { + return function(e) { + var val = this.checked + localStorage[key] = JSON.stringify(val) + } + } } } @@ -70,6 +101,11 @@ $clone.insertAfter(link.node) } + App.options.add('inline', 'Inline quoted posts') + + if (!App.options.get('inline')) + return + $('head').append( '