From 36b9b07156f217eda468b1370162c497b97f07ff Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 30 Nov 2010 19:55:51 +1100 Subject: Page number display fix. --- templates/thread.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/thread.html') diff --git a/templates/thread.html b/templates/thread.html index bd1fca57..2fb7a487 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -11,7 +11,7 @@

{board[url]} - {board[name]}

{board[title]}
- +
-- cgit v1.3 From 0e8fb7c898cdec3f77bae2e54af9a4f382cb2120 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 30 Nov 2010 20:11:22 +1100 Subject: Added a hidden "board" input --- templates/thread.html | 1 + 1 file changed, 1 insertion(+) (limited to 'templates/thread.html') diff --git a/templates/thread.html b/templates/thread.html index 2fb7a487..d78ca3f1 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -14,6 +14,7 @@ +
@@ -71,6 +71,10 @@
+
+
+ +
} diff --git a/templates/thread.html b/templates/thread.html index 95867830..a2f61df8 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -22,7 +22,7 @@ Name @@ -58,6 +58,19 @@ + {mod? + + + + + }
-- cgit v1.3 From 739bccd1bf5b2f3a681f4ff6e33d4a4018da22e5 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 30 Nov 2010 20:26:55 +1100 Subject: Made the subtitle optional in templates. --- templates/index.html | 3 ++- templates/thread.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'templates/thread.html') diff --git a/templates/index.html b/templates/index.html index 1f459483..58529230 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,7 +10,8 @@

{board[url]} - {board[name]}

-
{board[title]}
+
{board[title]?{board[title]}}
+ diff --git a/templates/thread.html b/templates/thread.html index d78ca3f1..f0f271b7 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -10,7 +10,8 @@

{board[url]} - {board[name]}

-
{board[title]}
+
{board[title]?{board[title]}}
+ -- cgit v1.3 From 466d5e4832d68f6e3a88957db1b0997d12550711 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 16 Dec 2010 19:12:13 +1100 Subject: "Return to dashboard" links --- templates/index.html | 3 ++- templates/page.html | 3 +-- templates/thread.html | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'templates/thread.html') diff --git a/templates/index.html b/templates/index.html index 048a3dd9..7aaf72e0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,7 +10,8 @@

{board[url]} - {board[name]}

-
{board[title]?{board[title]}}
+
{board[title]?{board[title]}}

{mod?Return to dashboard}

+ diff --git a/templates/page.html b/templates/page.html index 487f8f28..9e243b75 100644 --- a/templates/page.html +++ b/templates/page.html @@ -8,8 +8,7 @@

{title}

-
{subtitle?{subtitle}}
- {mod?Return to dashboard} +
{subtitle?{subtitle}}

{mod?Return to dashboard}

{body}

Copyright © 2010 OmegaSDG

diff --git a/templates/thread.html b/templates/thread.html index f0f271b7..a56a3ad7 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -11,6 +11,7 @@

{board[url]} - {board[name]}

{board[title]?{board[title]}}
+ {mod?Return to dashboard} -- cgit v1.3 From ae122f9754f801d201c80511fa5a3174e7f0bdc9 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 16 Dec 2010 21:11:44 +1100 Subject: "Return to dashboard" link on threads --- templates/thread.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'templates/thread.html') diff --git a/templates/thread.html b/templates/thread.html index a56a3ad7..36dd2b49 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -10,8 +10,7 @@

{board[url]} - {board[name]}

-
{board[title]?{board[title]}}
- {mod?Return to dashboard} +
{board[title]?{board[title]}}

{mod?Return to dashboard}

-- cgit v1.3 From db50d076819cfec3bd19faad0d1e194914c51dcd Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 16 Dec 2010 21:43:01 +1100 Subject: Fixed "Return" links in threads --- inc/functions.php | 3 ++- templates/thread.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'templates/thread.html') diff --git a/inc/functions.php b/inc/functions.php index bc6fce45..04340be1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -361,7 +361,8 @@ 'post_url' => POST_URL, 'index' => ROOT, 'id' => $id, - 'mod' => $mod + 'mod' => $mod, + 'return' => ($mod ? '?' . $board['url'] . FILE_INDEX : ROOT . $board['uri'] . '/' . FILE_INDEX) )); if($return) diff --git a/templates/thread.html b/templates/thread.html index 36dd2b49..e816e127 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -12,7 +12,7 @@

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

- + -- cgit v1.3 From 82557e2c125989cccae40b4b82c2e310f05409c4 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sun, 2 Jan 2011 21:10:18 +1100 Subject: Fixed encodign errors --- templates/index.html | 20 +++++++++++++++++++- templates/login.html | 2 +- templates/page.html | 2 +- templates/thread.html | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) (limited to 'templates/thread.html') diff --git a/templates/index.html b/templates/index.html index 7aaf72e0..99c60d4f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,4 @@ - + @@ -15,6 +15,7 @@ + {mod?}
+ {mod? + + + + + }
@@ -57,6 +58,23 @@
+ Flags + +
+ +
+
+
+
+ +
+
Password diff --git a/templates/login.html b/templates/login.html index 5ce955a7..312bd6e9 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,4 +1,4 @@ -
+
{error?

{error}

} diff --git a/templates/page.html b/templates/page.html index 9e243b75..d8b78898 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,4 +1,4 @@ - + diff --git a/templates/thread.html b/templates/thread.html index e816e127..e0c33a1e 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -1,4 +1,4 @@ - + -- cgit v1.3 From 010dda16c43fc920b67e9dd4696f2dd8cd560ff4 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sun, 2 Jan 2011 21:20:16 +1100 Subject: mod posts in threads --- templates/thread.html | 1 + 1 file changed, 1 insertion(+) (limited to 'templates/thread.html') diff --git a/templates/thread.html b/templates/thread.html index e0c33a1e..58b5028c 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -16,6 +16,7 @@ + {mod?}
diff --git a/templates/thread.html b/templates/thread.html index e1260ff5..82867ec2 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -8,6 +8,7 @@ +

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

@@ -39,7 +40,7 @@ -- cgit v1.3 From 0190dcfa52aee3acd6871cd1885ed171ad30c69f Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 20 Jan 2011 19:34:16 +1100 Subject: changed omegadev.org to omegasdg.com --- README.md | 2 +- templates/index.html | 3 +-- templates/page.html | 2 +- templates/thread.html | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'templates/thread.html') diff --git a/README.md b/README.md index 2cd9ba2c..3d59f3c5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Tinyboard is an imageboard software package written in PHP. It aims to maintain Tinyboard is not currently at a stable state. -[o]: http://omegadev.org/ +[o]: http://omegasdg.com/ ## Requirements 1. PHP >= 5.2.0 diff --git a/templates/index.html b/templates/index.html index acca2408..219fec12 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,7 +8,6 @@ -

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

@@ -91,6 +90,6 @@ Pages: {pages: [{pages[num]}]{!%last? } } -

Copyright © 2010 OmegaSDG

+

Copyright © 2010 OmegaSDG

\ No newline at end of file diff --git a/templates/page.html b/templates/page.html index f8525e01..ddcac8c6 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,6 +11,6 @@
{subtitle?{subtitle}}

{mod?Return to dashboard}

{body}
-

Copyright © 2010 OmegaSDG

+

Copyright © 2010 OmegaSDG

\ No newline at end of file diff --git a/templates/thread.html b/templates/thread.html index 82867ec2..d6a48213 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -8,7 +8,6 @@ -

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

@@ -73,6 +72,6 @@
{body} [Return.] -

Copyright © 2010 OmegaSDG

+

Copyright © 2010 OmegaSDG

\ No newline at end of file -- cgit v1.3 From 8edccdb2aacabeb120d7ade1f82d62975efd4eaf Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 21 Jan 2011 13:13:50 +1100 Subject: added delete form in templates --- templates/index.html | 11 +++++++++++ templates/thread.html | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'templates/thread.html') diff --git a/templates/index.html b/templates/index.html index 219fec12..9df80376 100644 --- a/templates/index.html +++ b/templates/index.html @@ -86,7 +86,18 @@
-- cgit v1.3 From 3a3578c80507d80d571297b6bbf2502d5da73fd9 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Mon, 3 Jan 2011 16:29:34 +1100 Subject: Valid HTML5 --- inc/config.php | 2 +- inc/display.php | 4 ++-- templates/index.html | 3 +-- templates/page.html | 2 +- templates/thread.html | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) (limited to 'templates/thread.html') diff --git a/inc/config.php b/inc/config.php index d40f7654..521d3eb3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -202,7 +202,7 @@ // Correspond to above permission directives define('MOD_LINK_DELETE', '[D]', true); define('MOD_LINK_BAN', '[B]', true); - define('MOD_LINK_BANDELETE', '[B&D]', true); + define('MOD_LINK_BANDELETE', '[B&D]', true); define('MOD_LINK_DELETEFILE', '[F]', true); define('MOD_LINK_DELETEBYIP', '[D+]', true); define('MOD_LINK_STICKY', '[Sticky]', true); diff --git a/inc/display.php b/inc/display.php index 58f26960..edcbf21b 100644 --- a/inc/display.php +++ b/inc/display.php @@ -138,7 +138,7 @@ ($index?'':' onclick="highlightReply(' . $this->id . ');"') . ' href="' . $this->root . $board['dir'] . DIR_RES . $this->thread . '.html' . '#' . $this->id . '">No.' . // JavaScript cite - ''.$this->id.'' . + ''.$this->id.'' . '

'; // File info @@ -290,7 +290,7 @@ ($index?'':' onclick="highlightReply(' . $this->id . ');"') . ' href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html' . '#' . $this->id . '">No.' . // JavaScript cite - ''.$this->id.'' . + ''.$this->id.'' . // Sticky ($this->sticky ? '' : '') . // Locked diff --git a/templates/index.html b/templates/index.html index 99c60d4f..d0702ba9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,8 +3,7 @@ {board[url]} - {board[name]} - - + diff --git a/templates/page.html b/templates/page.html index d8b78898..f8525e01 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,7 +3,7 @@ {title} - + diff --git a/templates/thread.html b/templates/thread.html index 58b5028c..2fd03418 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -3,8 +3,7 @@ {board[url]} - {board[name]} - - + -- cgit v1.3 From c59f36f400eb718714154fa1ab125662bc7b89ea Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 19 Jan 2011 12:37:31 +1100 Subject: a bunch of things --- inc/config.php | 21 ++++++++++++++++++--- inc/functions.php | 35 ++++++++++++++++++++++++++++++++--- mod.php | 2 +- post.php | 45 ++++++++++++++++++++++++++++++++++++++++----- style.css | 4 ++++ templates/posts.sql | 2 +- templates/thread.html | 1 + 7 files changed, 97 insertions(+), 13 deletions(-) (limited to 'templates/thread.html') diff --git a/inc/config.php b/inc/config.php index 746efb63..65346edd 100644 --- a/inc/config.php +++ b/inc/config.php @@ -41,7 +41,8 @@ define('COOKIE_EXPIRE', 15778463, true); //6 months // Make this something long and random for security define('SALT', 'wefaw98YHEWUFuo', true); - + define('SECURE_TRIP_SALT', '@#$&^@#)$(*&@!_$(&329-8347', true); + // How many seconds before you can post, after the first visit define('LURKTIME', 30, true); @@ -51,6 +52,8 @@ define('FLOOD_TIME_IP_SAME', 120, true); // Same as above but different IP address define('FLOOD_TIME_SAME', 30, true); + // Do you need a body for your non-OP posts? + define('FORCE_BODY', true, true); // Max body length define('MAX_BODY', 1800, true); @@ -77,6 +80,9 @@ define('ERROR_NOPOST', 'You didn\'t make a post.', true); define('ERROR_FLOOD', 'Flood detected; Post discared.', true); define('ERROR_UNORIGINAL', 'Unoriginal content!', true); + define('ERROR_MUTED', 'Unoriginal content! You have been muted for %d seconds.', true); + define('ERROR_TOR', 'Hmm… That looks like a Tor exit node.', true); + define('ERROR_TOOMANYLINKS', 'Too many links; flood detected.', true); define('ERR_INVALIDIMG','Invalid image.', true); define('ERR_FILESIZE', 'Maximum file size: %maxsz% bytes
Your file\'s size: %filesz% bytes', true); define('ERR_MAXSIZE', 'The file was too big.', true); @@ -103,7 +109,11 @@ // Function name for hashing // sha1_file, md5_file, etc. define('FILE_HASH', 'sha1_file', true); - + + define('BLOCK_TOR', true, true); + // Typically spambots try to post a lot of links. Refuse a post with X standalone links? + define('MAX_LINKS', 7, true); + // Maximum image upload size in bytes define('MAX_FILESIZE', 10*1024*1024, true); // 10MB // Maximum image dimensions @@ -167,8 +177,13 @@ // Robot stuff // Strip repeating characters when making hashes define('ROBOT_ENABLE', true, true); + define('ROBOT_BOARD', 'r9k', true); define('ROBOT_STRIP_REPEATING', true, true); - + // Enable mutes + define('ROBOT_MUTE', true, true); + define('ROBOT_MUTE_MIN', 60, true); + define('ROBOT_MUTE_MAX', 120, true); + define('ROBOT_MUTE_DESCRIPTION', 'You have been muted for unoriginal content.', true); /* Mod stuff diff --git a/inc/functions.php b/inc/functions.php index 4f4a69bd..6193ab38 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -439,14 +439,43 @@ } } } + + function isDNSBL() { + $dns_black_lists = file('./dnsbl.txt', FILE_IGNORE_NEW_LINES); + + // Reverse the IP + $rev_ip = implode(array_reverse(explode('.', $_SERVER['REMOTE_ADDR'])), '.'); + $response = array(); + foreach ($dns_black_lists as $dns_black_list) { + $response = (gethostbynamel($rev_ip . '.' . $dns_black_list)); + if(!empty($response)) + return true; + } + + return false; + } + + function isTor() { + return gethostbyname( + ReverseIPOctets($_SERVER['REMOTE_ADDR']) . '.' . $_SERVER['SERVER_PORT'] . '.' . ReverseIPOctets($_SERVER['SERVER_ADDR']) . '.ip-port.exitlist.torproject.org' + ) == '127.0.0.2'; + } + + function ReverseIPOctets($inputip) { + $ipoc = explode('.', $inputip); + return $ipoc[3] . '.' . $ipoc[2] . '.' . $ipoc[1] . '.' . $ipoc[0]; + } function markup(&$body) { global $board; $body = utf8tohtml($body, true); - if(MARKUP_URLS) - $body = preg_replace(URL_REGEX, "$0", $body); + if(MARKUP_URLS) { + $body = preg_replace(URL_REGEX, "$0", $body, -1, $num_links); + if($num_links > MAX_LINKS) + error(ERROR_TOOMANYLINKS); + } if(AUTO_UNICODE) { $body = str_replace('...', '…', $body); @@ -602,7 +631,7 @@ $salt = strtr ( $salt, ':;<=>?@[\]^_`', 'ABCDEFGabcdef' ); if ( isset ( $t[2] ) ) { // secure - $trip = '!!' . substr ( crypt ( $trip, '@#$%^&*()' ), ( -1 * $length ) ); + $trip = '!!' . substr ( crypt ( $trip, SECURE_TRIP_SALT ), ( -1 * $length ) ); } else { // insecure $trip = '!' . substr ( crypt ( $trip, $salt ), ( -1 * $length ) ); diff --git a/mod.php b/mod.php index b4355fe4..80647471 100644 --- a/mod.php +++ b/mod.php @@ -464,7 +464,7 @@ openBoard($_board['uri']); $temp = ''; - $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `time` LIMIT :limit", $_board['uri'])); + $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `time` DESC LIMIT :limit", $_board['uri'])); $query->bindValue(':ip', $ip); $query->bindValue(':limit', MOD_IP_RECENTPOSTS, PDO::PARAM_INT); $query->execute() or error(db_error($query)); diff --git a/post.php b/post.php index 40830f0f..b8724522 100644 --- a/post.php +++ b/post.php @@ -62,6 +62,9 @@ // Check if banned checkBan(); + if(BLOCK_TOR && isTor()) + error(ERROR_TOR); + // Check if board exists if(!openBoard($post['board'])) error(ERROR_NOBOARD); @@ -85,6 +88,9 @@ $post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']); $post['mod'] = isset($_POST['mod']) && $_POST['mod']; + if(empty($post['body']) && FORCE_BODY) + error(ERROR_TOOSHORTBODY); + if($post['mod']) { require 'inc/mod.php'; if(!$mod) { @@ -115,6 +121,15 @@ 'maxsz'=>commaize(MAX_FILESIZE)))); } + if($mod && $mod['type'] >= MOD_MOD && preg_match('/^((.+) )?## (.+)$/', $post['name'], $match)) { + if(($mod['type'] == MOD_MOD && $match[3] == 'Mod') || $mod['type'] >= MOD_ADMIN) { + $post['mod_tag'] = $match[3]; + $post['name'] = !empty($match[2])?$match[2]:'Anonymous'; + } + } else { + $post['mod_tag'] = false; + } + $trip = generate_tripcode($post['name']); $post['name'] = $trip[0]; $post['trip'] = (isset($trip[1])?$trip[1]:''); @@ -134,21 +149,40 @@ } // Check string lengths - if(strlen($post['name']) > 25) error(sprintf(ERROR_TOOLONG, 'name')); + if(strlen($post['name']) > 25) error(sprintf(ERROR_TOOLONG, 'name')); if(strlen($post['email']) > 30) error(sprintf(ERROR_TOOLONG, 'email')); if(strlen($post['subject']) > 40) error(sprintf(ERROR_TOOLONG, 'subject')); if(strlen($post['body']) > MAX_BODY) error(ERROR_TOOLONGBODY); if(!(!$OP && $post['has_file']) && strlen($post['body']) < 1) error(ERROR_TOOSHORTBODY); if(strlen($post['password']) > 20) error(sprintf(ERROR_TOOLONG, 'password')); + if($post['mod_tag']) + $post['trip'] .= ' ## ' . $post['mod_tag'] . ''; + + if(!($mod && $mod['type'] >= MOD_POSTUNORIGINAL) && ROBOT_ENABLE && $board['uri'] == ROBOT_BOARD && checkRobot($post['body'])) { + if(ROBOT_MUTE) { + $mutetime = ROBOT_MUTE_MIN+rand()%(ROBOT_MUTE_MAX-ROBOT_MUTE_MIN); + + $query = prepare("INSERT INTO `bans` VALUES (:ip, :mod, :set, :expires, :reason)"); + $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); + $query->bindValue(':mod', -1, PDO::PARAM_INT); + $query->bindValue(':set', time(), PDO::PARAM_INT); + $query->bindValue(':expires', time()+$mutetime, PDO::PARAM_INT); + $query->bindValue(':reason', ROBOT_MUTE_DESCRIPTION); + $query->execute() or error(db_error($query)); + + error(sprintf(ERROR_MUTED, $mutetime)); + } else { + error(ERROR_UNORIGINAL); + } + } + markup($post['body']); // Check for a flood - if(checkFlood($post)) + if(checkFlood($post)) { error(ERROR_FLOOD); - - if(!($mod && $mod['type'] >= MOD_POSTUNORIGINAL) && ROBOT_ENABLE && checkRobot($post['body'])) - error(ERROR_UNORIGINAL); + } if($post['has_file']) { // Just trim the filename if it's too long @@ -206,6 +240,7 @@ imagebmp($image, $post['file']); break; default: + unlink($post['file']); error('Unknwon file extension.'); } } diff --git a/style.css b/style.css index 60c36d19..058de230 100644 --- a/style.css +++ b/style.css @@ -146,6 +146,10 @@ p.intro span.name { color: #117743; font-weight: bold; } +p.intro a.nametag { + color: #F00000; + margin-left: 0; +} p.intro a { margin-left: 8px; } diff --git a/templates/posts.sql b/templates/posts.sql index 4163f125..f8e1b6fb 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `posts_{board}` ( `subject` varchar(40) NOT NULL, `email` varchar(30) NOT NULL, `name` varchar(25) NOT NULL, - `trip` varchar(15) DEFAULT NULL, + `trip` varchar(45) DEFAULT NULL, `body` text NOT NULL, `time` int(11) NOT NULL, `bump` int(11) DEFAULT NULL, diff --git a/templates/thread.html b/templates/thread.html index 2fd03418..e1260ff5 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -71,6 +71,7 @@
{body} + [Return.]

Copyright © 2010 OmegaSDG

\ No newline at end of file -- cgit v1.3 From d7f7b602efc6668557e1c0f544dd3bab0e677122 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 20 Jan 2011 19:25:11 +1100 Subject: ... --- mod.php | 17 +++++++++++++++++ templates/index.html | 3 ++- templates/thread.html | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'templates/thread.html') diff --git a/mod.php b/mod.php index 80647471..04b758f6 100644 --- a/mod.php +++ b/mod.php @@ -348,6 +348,23 @@ header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP); else header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP); + } elseif(preg_match('/^\/' . $regex['board'] . 'deletebyip\/(\d+)$/', $query, $matches)) { + // Delete all posts by an IP + + $boardName = $matches[1]; + $post = $matches[2]; + // Open board + if(!openBoard($boardName)) + error(ERROR_NOBOARD); + + $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri'])); + $query->bindValue(':ip', $ip); + $query->execute() or error(db_error($query)); + + //if(isset($_SERVER['HTTP_REFERER'])) + // header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP); + //else + // header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP); } elseif(preg_match('/^\/ban$/', $query)) { // Ban page diff --git a/templates/index.html b/templates/index.html index d0702ba9..acca2408 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,6 +8,7 @@ +

{board[url]} - {board[name]}

{board[title]?{board[title]}}

{mod?Return to dashboard}

@@ -38,7 +39,7 @@
- +
- +

+
+ + + {mod?} {body} +
+ Delete Post [ + ] Password + + +
+
Pages: {pages: [{pages[num]}]{!%last? } } diff --git a/templates/thread.html b/templates/thread.html index d6a48213..f8f71640 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -70,7 +70,18 @@

+
+ + + {mod?} {body} +
+ Delete Post [ + ] Password + + +
+
[Return.]

Copyright © 2010 OmegaSDG

-- cgit v1.3 From 701602d16a364990c805ef3f47a1dc21a765312c Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 22 Jan 2011 03:41:00 +1100 Subject: copyright update --- README.md | 2 +- templates/index.html | 2 +- templates/page.html | 2 +- templates/thread.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'templates/thread.html') diff --git a/README.md b/README.md index 3d59f3c5..b57169ce 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ An automated installation script will be completed soon. [r]: http://github.com/savetheinternet/Tinyboard/blob/master/README.md ## License -Copyright (c) 2010 by Omega Software Development Group +Copyright (c) 2010-2011 by Omega Software Development Group Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright diff --git a/templates/index.html b/templates/index.html index 9df80376..88101984 100644 --- a/templates/index.html +++ b/templates/index.html @@ -101,6 +101,6 @@ Pages: {pages: [{pages[num]}]{!%last? } } -

Copyright © 2010 OmegaSDG

+

Copyright © 2010-2011 OmegaSDG

\ No newline at end of file diff --git a/templates/page.html b/templates/page.html index ddcac8c6..5246dd62 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,6 +11,6 @@
{subtitle?{subtitle}}

{mod?Return to dashboard}

{body}
-

Copyright © 2010 OmegaSDG

+

Copyright © 2010-2011 OmegaSDG

\ No newline at end of file diff --git a/templates/thread.html b/templates/thread.html index f8f71640..95867830 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -83,6 +83,6 @@ [Return.] -

Copyright © 2010 OmegaSDG

+

Copyright © 2010-2011 OmegaSDG

\ No newline at end of file -- cgit v1.3 From d448125d991d8bb179c27801c64b0debcfeb959f Mon Sep 17 00:00:00 2001 From: "Michael D. Reiley" Date: Thu, 27 Jan 2011 09:19:17 -0800 Subject: Updated licensing. --- LICENSE | 34 +++++++++++++++++++++------------- templates/index.html | 4 ++-- templates/page.html | 4 ++-- templates/thread.html | 4 ++-- 4 files changed, 27 insertions(+), 19 deletions(-) (limited to 'templates/thread.html') diff --git a/LICENSE b/LICENSE index 3c10b3ca..3a742f99 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,21 @@ -Copyright (c) 2010 by Omega Software Development Group - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above copyright -notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file +Copyright (c) 2010-2011, Omega Software Development Group + +Permission to use, copy, modify, and/or distribute this software is granted, +provided that the following terms are obeyed. + +1. The above copyright notice, this permission notice, and these terms must +appear in all copies and modifications of this software. + +2. This software must not be utilized in any manner that is primarily intended +for or directed toward commercial advantage or private monetary compensation. + +3. Any changes to this software must be made easily publicly available in the +form of source code. + +THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/templates/index.html b/templates/index.html index 88101984..9cc085d1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -101,6 +101,6 @@ Pages: {pages: [{pages[num]}]{!%last? } } -

Copyright © 2010-2011 OmegaSDG

+

TinyBoard Software Copyright © 2010-2011 OmegaSDG

- \ No newline at end of file + diff --git a/templates/page.html b/templates/page.html index 5246dd62..75b9ecdd 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,6 +11,6 @@
{subtitle?{subtitle}}

{mod?Return to dashboard}

{body}
-

Copyright © 2010-2011 OmegaSDG

+

TinyBoard Software Copyright © 2010-2011 OmegaSDG

- \ No newline at end of file + diff --git a/templates/thread.html b/templates/thread.html index 95867830..918d4c0b 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -83,6 +83,6 @@ [Return.] -

Copyright © 2010-2011 OmegaSDG

+

TinyBoard Software Copyright © 2010-2011 OmegaSDG

- \ No newline at end of file + -- cgit v1.3 From 4bcd995bea62a164dec0c7adf0c2cba3735b6a18 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 3 Feb 2011 20:28:14 +1100 Subject: raw html --- inc/config.php | 12 ++++++++---- post.php | 31 +++++++++++++++---------------- templates/index.html | 6 +++++- templates/thread.html | 15 ++++++++++++++- 4 files changed, 42 insertions(+), 22 deletions(-) (limited to 'templates/thread.html') diff --git a/inc/config.php b/inc/config.php index 0cdd2934..bf3956fe 100644 --- a/inc/config.php +++ b/inc/config.php @@ -39,6 +39,8 @@ // How long should the cookies last (in seconds) define('COOKIE_EXPIRE', 15778463, true); //6 months + // How long should moderators should remain logged in (0=browser session) (in seconds) + define('MOD_EXPIRE', 15778463, true); // Make this something long and random for security define('SALT', 'wefaw98YHEWUFuo', true); define('SECURE_TRIP_SALT', '@#$&^@#)$(*&@!_$(&329-8347', true); @@ -47,7 +49,7 @@ define('LURKTIME', 30, true); // How many seconds between each post - define('FLOOD_TIME', 4, true); + define('FLOOD_TIME', 10, true); // How many seconds between each post with exactly the same content and same IP define('FLOOD_TIME_IP_SAME', 120, true); // Same as above but different IP address @@ -108,8 +110,8 @@ define('REPLY_LIMIT', 250, true); // For resizing, max values - define('THUMB_WIDTH', 250, true); - define('THUMB_HEIGHT', 250, true); + define('THUMB_WIDTH', 225, true); + define('THUMB_HEIGHT', 225, true); // Store image hash in the database for r9k-like boards implementation soon // Function name for hashing @@ -118,7 +120,7 @@ define('BLOCK_TOR', true, true); // Typically spambots try to post a lot of links. Refuse a post with X standalone links? - define('MAX_LINKS', 15, true); + define('MAX_LINKS', 20, true); // Maximum image upload size in bytes define('MAX_FILESIZE', 10*1024*1024, true); // 10MB @@ -236,6 +238,8 @@ define('MOD_POSTINLOCKED', MOD_MOD, true); // Post bypass unoriginal content check define('MOD_POSTUNORIGINAL', MOD_MOD, true); + // Raw HTML posting + define('MOD_RAWHTML', MOD_MOD, true); /* Administration */ // Display the contents of instant-config.php diff --git a/post.php b/post.php index ec21d66f..62260e1b 100644 --- a/post.php +++ b/post.php @@ -99,9 +99,9 @@ $post['thread'] = round($_POST['thread']); } else $OP = true; - if(!(($OP && $_POST['post'] == BUTTON_NEWTOPIC) || - (!$OP && $_POST['post'] == BUTTON_REPLY))) - error(ERROR_BOT); + //if(!(($OP && $_POST['post'] == BUTTON_NEWTOPIC) || + // (!$OP && $_POST['post'] == BUTTON_REPLY))) + // error(ERROR_BOT); // Check the referrer if($OP) { @@ -151,7 +151,7 @@ $post['email'] = utf8tohtml($_POST['email']); $post['body'] = $_POST['body']; $post['password'] = $_POST['password']; - $post['filename'] = $_FILES['file']['name']; + $post['filename'] = get_magic_quotes_gpc() ? stripslashes($_FILES['file']['name']) : $_FILES['file']['name']; $post['has_file'] = $OP || !empty($_FILES['file']['tmp_name']); $post['mod'] = isset($_POST['mod']) && $_POST['mod']; @@ -167,9 +167,11 @@ $post['sticky'] = $OP && isset($_POST['sticky']); $post['locked'] = $OP && isset($_POST['lock']); + $post['raw'] = isset($_POST['raw']); if($post['sticky'] && $mod['type'] < MOD_STICKY) error(ERROR_NOACCESS); if($post['locked'] && $mod['type'] < MOD_LOCK) error(ERROR_NOACCESS); + if($post['raw'] && $mod['type'] < MOD_RAWHTML) error(ERROR_NOACCESS); } // Check if thread is locked @@ -208,7 +210,7 @@ if($post['has_file']) { $post['extension'] = strtolower(substr($post['filename'], strrpos($post['filename'], '.') + 1)); - $post['file_id'] = rand(0, 1000000000); + $post['file_id'] = time() . rand(100, 999); $post['file'] = $board['dir'] . DIR_IMG . $post['file_id'] . '.' . $post['extension']; $post['thumb'] = $board['dir'] . DIR_THUMB . $post['file_id'] . '.png'; $post['zip'] = $OP && $post['has_file'] && ALLOW_ZIP && $post['extension'] == 'zip' ? $post['file'] : false; @@ -216,7 +218,7 @@ } // Check string lengths - if(strlen($post['name']) > 25) error(sprintf(ERROR_TOOLONG, 'name')); + if(strlen($post['name']) > 50) error(sprintf(ERROR_TOOLONG, 'name')); if(strlen($post['email']) > 30) error(sprintf(ERROR_TOOLONG, 'email')); if(strlen($post['subject']) > 40) error(sprintf(ERROR_TOOLONG, 'subject')); if(strlen($post['body']) > MAX_BODY) error(ERROR_TOOLONGBODY); @@ -227,7 +229,9 @@ $post['trip'] .= ' ## ' . $post['mod_tag'] . ''; $post['body_nomarkup'] = $post['body']; - markup($post['body']); + + if(!($mod && $post['raw'])) + markup($post['body']); // Check for a flood if(checkFlood($post)) { @@ -415,14 +419,10 @@ unlink($post['zip']); } - if(numPosts($OP?$id:$post['thread']) > REPLY_LIMIT) { - deletePost($OP?$id:$post['thread']); - } else { - buildThread(($OP?$id:$post['thread'])); - - if(!$OP && $post['email'] != 'sage') { - bumpThread($post['thread']); - } + buildThread(($OP?$id:$post['thread'])); + + if(!$OP && strtolower($post['email']) != 'sage' && (REPLY_LIMIT == 0 || numPosts($post['thread']) < REPLY_LIMIT)) { + bumpThread($post['thread']); } if($OP) @@ -431,7 +431,6 @@ buildIndex(); sql_close(); - $root = $post['mod'] ? ROOT . FILE_MOD . '?/' : ROOT; if(ALWAYS_NOKO || $noko) { diff --git a/templates/index.html b/templates/index.html index 88101984..d24f5b28 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,7 +21,7 @@ Name
- +
- +
+ Flags + +
+
+ +
+
Password -- cgit v1.3 From 5b8ace603e75c736d62fbbe572696cfc2729d6d7 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 3 Feb 2011 20:31:32 +1100 Subject: Raw HTML posting --- templates/index.html | 2 +- templates/thread.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'templates/thread.html') diff --git a/templates/index.html b/templates/index.html index 6cc87fe9..142316fd 100644 --- a/templates/index.html +++ b/templates/index.html @@ -107,4 +107,4 @@ }

TinyBoard Software Copyright © 2010-2011 OmegaSDG

- + \ No newline at end of file diff --git a/templates/thread.html b/templates/thread.html index bd89299d..bc11f1a8 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -98,4 +98,4 @@ [Return.]

TinyBoard Software Copyright © 2010-2011 OmegaSDG

- + \ No newline at end of file -- cgit v1.3 From 0346862645aa0b9a8ba0f0d929b336b08ff8fcf4 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 11 Feb 2011 22:44:49 +1100 Subject: Corrected spelling of "Tinyboard" and updated license in the README --- README.md | 29 ++++++++++++++++++----------- templates/index.html | 2 +- templates/page.html | 2 +- templates/thread.html | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) (limited to 'templates/thread.html') diff --git a/README.md b/README.md index b57169ce..bad204dc 100644 --- a/README.md +++ b/README.md @@ -32,17 +32,24 @@ An automated installation script will be completed soon. [r]: http://github.com/savetheinternet/Tinyboard/blob/master/README.md ## License -Copyright (c) 2010-2011 by Omega Software Development Group +Copyright (c) 2010-2011, Omega Software Development Group -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above copyright -notice and this permission notice appear in all copies. +Permission to use, copy, modify, and/or distribute this software is granted, +provided that the following terms are obeyed. -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +1. The above copyright notice, this permission notice, and these terms must +appear in all copies and modifications of this software. +2. This software must not be utilized in any manner that is primarily intended +for or directed toward commercial advantage or private monetary compensation. + +3. Any changes to this software must be made easily publicly available in the +form of source code. + +THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 142316fd..424cf21b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -105,6 +105,6 @@ Pages: {pages: [{pages[num]}]{!%last? } } -

TinyBoard Software Copyright © 2010-2011 OmegaSDG

+

Tinyboard Software Copyright © 2010-2011 OmegaSDG

\ No newline at end of file diff --git a/templates/page.html b/templates/page.html index 75b9ecdd..41f0d4e6 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,6 +11,6 @@
{subtitle?{subtitle}}

{mod?Return to dashboard}

{body}
-

TinyBoard Software Copyright © 2010-2011 OmegaSDG

+

Tinyboard Software Copyright © 2010-2011 OmegaSDG

diff --git a/templates/thread.html b/templates/thread.html index bc11f1a8..4fff9b88 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -96,6 +96,6 @@ [Return.] -

TinyBoard Software Copyright © 2010-2011 OmegaSDG

+

Tinyboard Software Copyright © 2010-2011 OmegaSDG

\ No newline at end of file -- cgit v1.3