summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-01-19 12:37:31 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-01-19 12:37:31 +1100
commitc59f36f400eb718714154fa1ab125662bc7b89ea (patch)
treebb4f8544cb351d897359fdc6ad79d48f8c9ee22b /inc
parent62bd2ee348f460b3d4cbbdbd8469a783b4c64c78 (diff)
a bunch of things
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php21
-rw-r--r--inc/functions.php35
2 files changed, 50 insertions, 6 deletions
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<br>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, "<a href=\"$0\">$0</a>", $body);
+ if(MARKUP_URLS) {
+ $body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $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 ) );