From bd128bf46557adf5bff5c69837f9a9440b30ce19 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 6 Apr 2015 20:12:37 -0700 Subject: [PATCH 01/14] This clean feature is too SQL intensive. Only check clean if in mod.php --- inc/display.php | 8 +++++--- inc/mod/pages.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/display.php b/inc/display.php index d595e5d0..eb766bdb 100644 --- a/inc/display.php +++ b/inc/display.php @@ -415,10 +415,10 @@ class Post { )); } - public function getClean( ) { + public function getClean($actually_do = false) { global $board, $config; - if( !isset( $this->clean ) ) { + if( !isset( $this->clean ) && $actually_do ) { if ($config['cache']['enabled'] && $this->clean = cache::get("post_clean_{$board['uri']}_{$this->id}")) { return $this->clean; } @@ -441,8 +441,10 @@ class Post { if ($config['cache']['enabled']) cache::set("post_clean_{$board['uri']}_{$this->id}", $this->clean); } + } else { + $this->clean = array(); } - + return $this->clean; } }; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 7efabae6..027dd5bf 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2507,7 +2507,7 @@ function mod_reports() { } // Fetch clean status. - $po->getClean(); + $po->getClean(true); $clean = $po->clean; From cde464b6bf7616462efdad1cae1c0d93008df9a2 Mon Sep 17 00:00:00 2001 From: Doctor-von-Piglet Date: Wed, 15 Apr 2015 12:03:42 -0700 Subject: [PATCH 02/14] replaced location.origin location.origin is not defined in all browsers. --- templates/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/main.js b/templates/main.js index 5401fa8b..836eda31 100644 --- a/templates/main.js +++ b/templates/main.js @@ -177,7 +177,7 @@ function highlightReply(id, event) { post.className += ' highlighted'; if (history.pushState) { - history.pushState(null, null, window.document.location.origin + window.document.location.pathname + window.document.location.search + '#' + id); + history.pushState(null, null, window.document.location.protocol + "//" + window.document.location.host + window.document.location.pathname + window.document.location.search + '#' + id); } else { window.location.hash = id; } From 31caeed7dbdead3094b22f823bce070d1c7ffeed Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 06:08:29 -0700 Subject: [PATCH 03/14] Fix no top bar boards --- boards.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/boards.php b/boards.php index 600951d4..0c1f33a8 100644 --- a/boards.php +++ b/boards.php @@ -100,7 +100,15 @@ if (count($_GET) == 0) { file_write("boards.html", $pageHTML); file_write("boards.json", json_encode($nonAssociativeBoardList)); - file_write("boards-top20.json", json_encode(array_splice($nonAssociativeBoardList, 0, 48))); + + $topbar = array(); + foreach ($boards as $i => $b) { + if (!in_array($b['uri'], $config['no_top_bar_boards'])) { + $topbar[] = $b; + } + } + + file_write("boards-top20.json", json_encode(array_splice($topbar, 0, 48))); } -echo $pageHTML; \ No newline at end of file +echo $pageHTML; From f34b376dfcf5d1c92c5ee719c931e2c812d6a95d Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 06:45:44 -0700 Subject: [PATCH 04/14] Title in boards.html --- boards.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/boards.php b/boards.php index 4f1f16fa..9ee74426 100644 --- a/boards.php +++ b/boards.php @@ -88,7 +88,8 @@ $searchHTML = Element("8chan/boards-search.html", array( $pageHTML = Element("page.html", array( "config" => $config, - "body" => $searchHTML + "body" => $searchHTML, + "title" => _("Boards on ∞chan") ) ); @@ -109,9 +110,6 @@ if (php_sapi_name() == 'cli') { } file_write("boards-top20.json", json_encode(array_splice($topbar, 0, 48))); - - echo "The board directories have regenerated."; - exit; } echo $pageHTML; From e44a609aa930ada32d8d0391e753d6a080d03452 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 06:46:02 -0700 Subject: [PATCH 05/14] Sorry, I don't like this logo addition. --- inc/instance-config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index c6fb8cea..6f756829 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -233,7 +233,7 @@ $config['page_404'] = 'page_404'; // Flavor and design. $config['site_name'] = "∞chan"; -$config['site_logo'] = "/static/logo_33.svg"; +#$config['site_logo'] = "/static/logo_33.svg"; // 8chan specific mod pages require '8chan-mod-config.php'; From 7fbb51bdd94b78d0572957886259a44beb9fcbfd Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 07:39:03 -0700 Subject: [PATCH 06/14] Fix thread stats not appearing --- js/thread-stats.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/thread-stats.js b/js/thread-stats.js index a4dda669..fe487e10 100644 --- a/js/thread-stats.js +++ b/js/thread-stats.js @@ -14,9 +14,8 @@ $(document).ready(function(){ var thread_id = (document.location.pathname + document.location.search).split('/'); thread_id = thread_id[thread_id.length -1].split('+')[0].split('.')[0]; - $('form[name="postcontrols"] > .delete') - .first() - .before('
'); + $('#thread-links') + .after('
'); var el = $('#thread_stats'); el.prepend('Page ?'); if (IDsupport){ From 96411813b43bd4337b27ccdc7a7b78fd4652e5ed Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 08:16:35 -0700 Subject: [PATCH 07/14] Rollback file_write function --- inc/functions.php | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 4c16f065..cfa3b353 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -628,47 +628,41 @@ function purge($uri) { function file_write($path, $data, $simple = false, $skip_purge = false) { global $config, $debug; - + if (preg_match('/^remote:\/\/(.+)\:(.+)$/', $path, $m)) { if (isset($config['remote'][$m[1]])) { require_once 'inc/remote.php'; - + $remote = new Remote($config['remote'][$m[1]]); $remote->write($data, $m[2]); return; - } - else { + } else { error('Invalid remote server: ' . $m[1]); } } - else { - // This will convert a local, relative path like "b/index.html" to a full path. - // dio_open does not work with relative paths on Windows machines. - $path = realpath(dirname($path)) . DIRECTORY_SEPARATOR . basename($path); - } - - if (!$fp = dio_open( $path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) { + + if (!$fp = dio_open($path, O_WRONLY | O_CREAT, 0644)) error('Unable to open file for writing: ' . $path); - } - + // File locking - if (function_exists("dio_fcntl") && dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) { + if (dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) { error('Unable to lock file: ' . $path); } - + + // Truncate file + if (!dio_truncate($fp, 0)) + error('Unable to truncate file: ' . $path); + // Write data - if (($bytes = dio_write($fp, $data)) === false) { + if (($bytes = dio_write($fp, $data)) === false) error('Unable to write to file: ' . $path); - } - + // Unlock - if (function_exists("dio_fcntl")) { - dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK)); - } - + dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK)); + // Close dio_close($fp); - + /** * Create gzipped file. * From 393088e04355e6a5514d4ed182d93751383d325b Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 08:16:47 -0700 Subject: [PATCH 08/14] Uptime not necessary in boards.php --- boards.php | 1 - 1 file changed, 1 deletion(-) diff --git a/boards.php b/boards.php index 9ee74426..d2410f00 100644 --- a/boards.php +++ b/boards.php @@ -79,7 +79,6 @@ $searchHTML = Element("8chan/boards-search.html", array( "founding_date" => $founding_date, "page_updated" => date('r'), - "uptime" => shell_exec('uptime -p'), "html_boards" => $boardsHTML, "html_tags" => $tagsHTML From 01114796fc27dd66a08edc68b5eb67423c6f590c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 08:17:00 -0700 Subject: [PATCH 09/14] jp>ja --- inc/instance-config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index 6f756829..cacaf6ee 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -197,7 +197,7 @@ 'fr' => "Français", 'hu' => "Magyar", 'it' => "Italiano", - 'jp' => "日本語", + 'ja' => "日本語", 'jbo' => "Lojban", 'lt' => "Lietuvių Kalba", 'lv' => "Latviešu Valoda", From 0db0ed3beb11e7755ccc778e1c90a154f5dc8c50 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 08:17:43 -0700 Subject: [PATCH 10/14] Hide report/delete by default (needs fix for no JS mode) --- stylesheets/style.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index a46677bb..4057418e 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1609,4 +1609,8 @@ td.board-tags a.tag-link { font-size: 0; width: 0; } -} \ No newline at end of file +} + +#post-moderation-fields { + display: none; +} From d3bb0266db455f4cc34b699d4d747c20015ea0bb Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 19 Apr 2015 08:18:12 -0700 Subject: [PATCH 11/14] Add stylesheet to 8chan/index.html --- templates/8chan/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/8chan/index.html b/templates/8chan/index.html index d8c6d40a..14f614b2 100644 --- a/templates/8chan/index.html +++ b/templates/8chan/index.html @@ -2,6 +2,7 @@ + ∞chan