From d8c385176ceaff6ced9b74cecc3750c45caa5d01 Mon Sep 17 00:00:00 2001
From: 8chan
Date: Fri, 21 Nov 2014 23:32:22 -0800
Subject: [PATCH 1/5] New claim.html page
---
claim.php | 60 ++++++++++++++++++++++++++++++++++++--
faq.php | 6 ++--
inc/8chan-mod-pages.php | 32 ++++++++++++++++++++
templates/8chan/index.html | 2 +-
4 files changed, 94 insertions(+), 6 deletions(-)
diff --git a/claim.php b/claim.php
index edc6669a..4c733180 100644
--- a/claim.php
+++ b/claim.php
@@ -1,5 +1,61 @@
execute();
+ $row = $query->fetch();
+ $ago = (new DateTime)->sub(new DateInterval('P1W'));
+ $mod_ago = (new DateTime)->sub(new DateInterval('P2W'));
-error('Automatic claiming is no longer available. To claim a board, send your request to admin@8chan.co along with the IP you used to post on that board.');
+ $last_activity_date = new DateTime();
+ $last_mod_date = new DateTime();
+
+ $last_activity_date->setTimestamp($row['time']);
+
+ $query = query("SELECT id, username FROM mods WHERE boards = '$board'");
+ $mods = $query->fetchAll();
+
+ if ($mods) {
+ $mod = $mods[0]['id'];
+ $query = query("SELECT MAX(time) AS time FROM modlogs WHERE `mod` = $mod");
+ $a = $query->fetchAll(PDO::FETCH_COLUMN);
+
+ if ($a[0]) {
+ $last_mod_date->setTimestamp($a[0]);
+ if (!$row['time'])
+ $last_activity_date->setTimestamp($a[0]);
+ } 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]);
+ $last_mod_date = false;
+ }
+ }
+
+ if ($mods and ($last_activity_date < $ago or ($last_mod_date and $last_mod_date < $mod_ago))) {
+ return array($last_activity_date, $last_mod_date, $mods);
+ }
+ else {
+ return false;
+ }
+}
+$q = query("SELECT uri FROM boards");
+$boards = $q->fetchAll(PDO::FETCH_COLUMN);
+$delete = array();
+foreach($boards as $board) {
+ $last_activity = last_activity($board);
+
+ if ($last_activity) {
+ list($last_activity_date, $last_mod_date, $mods) = $last_activity;
+
+ $last_mod_f = $last_mod_date ? $last_mod_date->format('Y-m-d H:i:s') : 'never';
+ $last_activity_f = $last_activity_date ? $last_activity_date->format('Y-m-d H:i:s') : 'never';
+ $delete[] = array('board' => $board, 'last_activity_date' => $last_activity_f, 'last_mod' => $last_mod_date, 'last_mod_f' => $last_mod_f);
+ }
+}
+$body = Element("8chan/claim.html", array("config" => $config, "delete" => $delete));
+echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Claim"), "subtitle" => _("Take deserted boards back from their owners")));
diff --git a/faq.php b/faq.php
index cc4dbd93..2ea68f72 100644
--- a/faq.php
+++ b/faq.php
@@ -34,9 +34,9 @@ $body = <<The admin can be reached at admin at 8chan dot co.
Help! My board has been deleted!
-Were you inactive for longer than one week? Were there no posts on the board for 72 hours?
+As of November 13th, 2014, board expiration no longer occurs.
-If either of those is true, the board was deleted automatically. You are free to recreate it. I cannot restore it, so don't bother emailing me about it.
+You still may lose access to your board, however, if you fail to log in for two weeks or it receives no posts for a week. See here for a list of boards that are available for reclaiming.
How do I post as a volunteer on my board?
Make sure you are using the volunteer interface to view your board. The URL of your browser should be https://8chan.co/mod.php?/yourboard.
@@ -47,7 +47,7 @@ $body = <<If they are doing something illegal, email me.
Can you give me X board?
-If the owner of the board is inactive or the board is broken due to bad CSS, sure. Send me an email.
+If the owner of the board is inactive or the board is broken due to bad CSS, sure. Send me an email. You can see a list of boards that qualify for being taken over here.
Can you add some new feature?
Open a Github issue. Better yet, write it yourself and open a pull request.
diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php
index 6b7f97b8..1073f3ba 100644
--- a/inc/8chan-mod-pages.php
+++ b/inc/8chan-mod-pages.php
@@ -49,6 +49,38 @@
$config['mod']['ban_appeals'] = BOARDVOLUNTEER;
$config['mod']['view_ban_appeals'] = BOARDVOLUNTEER;
$config['mod']['view_ban'] = BOARDVOLUNTEER;
+ $config['mod']['reassign_board'] = ADMIN;
+
+ $config['mod']['custom_pages']['/reassign/(\%b)'] = function($b) {
+ global $board, $config;
+
+ if (!openBoard($b))
+ error("Could not open board!");
+
+ if (!hasPermission($config['mod']['reassign_board'], $b))
+ error($config['error']['noaccess']);
+
+ $query = query("SELECT id, username FROM mods WHERE boards = '$b' AND type = 20");
+ $mods = $query->fetchAll();
+
+ if (!$mods) {
+ error('No mods?');
+ }
+
+ $password = base64_encode(openssl_random_pseudo_bytes(9));
+ $salt = generate_salt();
+ $hashed = hash('sha256', $salt . sha1($password));
+
+ $query = prepare('UPDATE ``mods`` SET `password` = :hashed, `salt` = :salt WHERE BINARY username = :mod');
+ $query->bindValue(':hashed', $hashed);
+ $query->bindValue(':salt', $salt);
+ $query->bindValue(':mod', $mods[0]['username']);
+ $query->execute();
+
+ $body = "Thanks for your interest in this board. Kindly find the username and password below. You can login at 8chan.co/mod.php.
Username: {$mods[0]['username']}
Password: {$password}
Thanks for using 8chan.co!";
+
+ mod_page(_('Edit reassign'), 'blank.html', array('board'=>$board,'token'=>make_secure_link_token('reassign/'.$board['uri']),'body'=>$body));
+ };
$config['mod']['custom_pages']['/volunteers/(\%b)'] = function($b) {
global $board, $config, $pdo;
diff --git a/templates/8chan/index.html b/templates/8chan/index.html
index dc120787..61cd051c 100644
--- a/templates/8chan/index.html
+++ b/templates/8chan/index.html
@@ -295,7 +295,7 @@
-
{% trans %}On ∞chan, you can create your own imageboard for free with no experience or programming knowledge needed. As long as the admin logs in once per week and it gets one new post every 72 hours, the board will be hosted forever.{% endtrans %}
+
{% trans %}On ∞chan, you can create your own imageboard for free with no experience or programming knowledge needed. As long as the board has unobtrusive CSS, the owner doesn't ban more than half the users, the owner logs in once every two weeks and it gets one new post every week, you will retain the board forever.{% endtrans %}
{% trans %}Warning: Some boards on this site might contain content of an adult or offensive nature. Please cease use of this site if it is illegal for you to view such content. The boards on this site are made entirely by the users and do not represent the opinions of the administration of 8chan.co. In the interest of free speech, only content that directly violates the DMCA or other US laws is deleted.{% endtrans %}
{% trans %}Create your board{% endtrans %}
From 8a608ab62365e7798c02e06f551bf26e6e76cdd5 Mon Sep 17 00:00:00 2001
From: 8chan
Date: Fri, 21 Nov 2014 23:33:05 -0800
Subject: [PATCH 2/5] Fix hide-threads.js interaction in no-animated-gif.js
---
js/no-animated-gif.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/js/no-animated-gif.js b/js/no-animated-gif.js
index 45a55f97..1b644ade 100644
--- a/js/no-animated-gif.js
+++ b/js/no-animated-gif.js
@@ -13,6 +13,8 @@
*/
function unanimate_gif(e) {
+ if ($(e).closest('.thread').children('.thread-hidden').length > 0) return;
+
if (active_page === "catalog")
var c = $('');
else
From 5daa887a92db34b6598153bd65ba25437ab15228 Mon Sep 17 00:00:00 2001
From: 8chan
Date: Fri, 21 Nov 2014 23:33:42 -0800
Subject: [PATCH 3/5] No need to display pruned in two places...especially if
server times out / errors
---
js/thread-stats.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/js/thread-stats.js b/js/thread-stats.js
index 7c13d66c..1785b79a 100644
--- a/js/thread-stats.js
+++ b/js/thread-stats.js
@@ -65,7 +65,7 @@ $(document).ready(function(){
$('#thread_stats_uids').text(size(ids));
}
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').success(function(data){
- var found, page = 'Pruned or Deleted';
+ var found, page = '???';
for (var i=0;data[i];i++){
var threads = data[i].threads;
for (var j=0; threads[j]; j++){
@@ -86,7 +86,7 @@ $(document).ready(function(){
// uses ajax call so it gets loaded on a delay (depending on network resources available)
var thread_stats_page_timer = setInterval(function(){
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').success(function(data){
- var found, page = 'Pruned or Deleted';
+ var found, page = '???';
for (var i=0;data[i];i++){
var threads = data[i].threads;
for (var j=0; threads[j]; j++){
From 467eee88c697a327604fd98aaac97a3325fec510 Mon Sep 17 00:00:00 2001
From: 8chan
Date: Fri, 21 Nov 2014 23:34:03 -0800
Subject: [PATCH 4/5] Make bottom watchlist-toggle work
---
js/thread-watcher.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/js/thread-watcher.js b/js/thread-watcher.js
index b66dc657..7f20e028 100644
--- a/js/thread-watcher.js
+++ b/js/thread-watcher.js
@@ -147,15 +147,16 @@ $(document).ready(function(){
}
//Append the watchlist toggle button.
- $('.boardlist').append('[ watchlist ]');
+ $('.boardlist').append('[ watchlist ]');
//Append a watch thread button after every OP.
- $('.op>.intro').append('[Watch Thread]');
+ $('.op>.intro').append('[Watch Thread]');
//Draw the watchlist, hidden.
watchlist.render();
//Show or hide the watchlist.
- $('#watchlist-toggle').on('click', function(e) {
+ $('.watchlist-toggle').on('click', function(e) {
+ e.preventDefault();
//if ctrl+click, reset the watchlist.
if (e.ctrlKey) {
watchlist.render(true);
@@ -169,7 +170,8 @@ $(document).ready(function(){
//Trigger the watchlist add function.
//The selector is passed as an argument in case the page is not a thread.
- $('.watchThread').on('click', function() {
+ $('.watchThread').on('click', function(e) {
+ e.preventDefault();
watchlist.add(this).render();
});
From 89f0d4f3bcc631e59252846e9363ec537ea36b52 Mon Sep 17 00:00:00 2001
From: 8chan
Date: Fri, 21 Nov 2014 23:34:23 -0800
Subject: [PATCH 5/5] This exclamation mark was confusing people
---
templates/8chan/create_success.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/8chan/create_success.html b/templates/8chan/create_success.html
index b129787c..25fe4177 100644
--- a/templates/8chan/create_success.html
+++ b/templates/8chan/create_success.html
@@ -1,5 +1,5 @@
{% trans %}Your new board is created and is live at{% endtrans %} /{{ uri }}/.
-{% trans %}Make sure you don't forget your password, {{ password }}!{% endtrans %}
+{% trans %}Make sure you don't forget your password, {{ password }}{% endtrans %}
{% trans %}You can manage your board at http://8chan.co/mod.php?/.{% endtrans %}