summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Knight <tomk@gentoo.org>2013-08-06 21:11:35 +0000
committerTom Knight <tomk@gentoo.org>2013-08-06 21:11:35 +0000
commitdb536c47bc9514cb76e428155fba7927d6cf8918 (patch)
tree9df5da9751b2cc98f37286cc6cbc6c9c085b0953
parentAfter discussion we will resize phpbb_search_results.search_id (diff)
downloadforums-db536c47bc9514cb76e428155fba7927d6cf8918.tar.gz
forums-db536c47bc9514cb76e428155fba7927d6cf8918.tar.bz2
forums-db536c47bc9514cb76e428155fba7927d6cf8918.zip
phpBB-2-0-23-gentoo-p10 ()
- Automatically add known spambots (England, Nowe Misato, Xrumer) to profile spammers table - Require admin activation when SFS is down - Send admin activation e-mails to f-mods instead of each admin
-rw-r--r--docs/ChangeLog7
-rw-r--r--htdocs/includes/stopforumspam.php20
-rw-r--r--htdocs/includes/usercp_register.php102
-rw-r--r--sql/release_2-0-23-gentoo-p10.sql1
4 files changed, 97 insertions, 33 deletions
diff --git a/docs/ChangeLog b/docs/ChangeLog
index 5cbfac441..baaf4ad03 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -1,3 +1,10 @@
+phpBB-2-0-23-gentoo-p10 ()
+- Automatically add known spambots (England, Nowe Misato, Xrumer) to profile spammers table (tomk)
+- Require admin activation when SFS is down (tomk)
+- Send admin activation e-mails to f-mods instead of each admin (tomk)
+
+-------------------------------------------------------------------------------
+
phpBB-2-0-23-gentoo-p9 (2013-04-21)
- increase size of some mediumint database IDs (tomk)
diff --git a/htdocs/includes/stopforumspam.php b/htdocs/includes/stopforumspam.php
index 49da0e14d..c99ab83fe 100644
--- a/htdocs/includes/stopforumspam.php
+++ b/htdocs/includes/stopforumspam.php
@@ -7,7 +7,7 @@
* email : tomk@gentoo.org
* dependencies : curl, curlwrappers, json
*
- * $Id: stopforumspam.php,v 1.2 2011/02/20 11:43:57 tomk Exp $
+ * $Id: stopforumspam.php,v 1.3 2011/02/21 17:12:53 tomk Exp $
*
*
***************************************************************************/
@@ -41,7 +41,7 @@ if (!defined('STOPFORUMSPAM_ADD_API_URL')) {
* @param string $username the username to check
* @param string $email the e-mail address to check
* @param string $ip the IP address to check
- * @return array|false return an array containg bool whether the user is listed on stopforumspam.com and the string reason. Returns false on error.
+ * @return array return an array containg bool whether request was successful, bool whether the user is listed on stopforumspam.com and the string reason.
*/
function stopforumspam_is_spammer($username, $email, $ip) {
global $board_config;
@@ -64,7 +64,7 @@ function stopforumspam_is_spammer($username, $email, $ip) {
if (empty($api_request)) {
// nothing to query, return false
- return array(false, "Error: empty api_request");
+ return array(false, false, "Error: empty api_request");
}
// trim last &
@@ -82,20 +82,20 @@ function stopforumspam_is_spammer($username, $email, $ip) {
$curl_status = curl_errno($ch);
if ($curl_status != 0) {
// curl error
- return array(false, "Error: curl error $curl_status");
+ return array(false, false, "Error: curl error $curl_status");
}
// check HTTP status
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_status != 200) {
// HTTP error
- return array(false, "Error: HTTP error $http_status");
+ return array(false, false, "Error: HTTP error $http_status");
}
// check we got a response
if (empty($json)) {
// no response
- return array(false, "Error: empty json response");
+ return array(false, false, "Error: empty json response");
}
// parse response
@@ -103,19 +103,19 @@ function stopforumspam_is_spammer($username, $email, $ip) {
if (empty($response)) {
// error parsing response
- return array(false, "Error: empty decoded json response");
+ return array(false, false, "Error: empty decoded json response");
}
// success flag doesn't seem to be set correctly on serial/json errors so check error message first
if (!empty($response->error)) {
// error calling API
- return array(false, "Error: API error " . $response->error);
+ return array(false, false, "Error: API error " . $response->error);
}
// check if API call successful
if (!$response->success) {
// error calling API
- return array(false, "Error: unsuccessful API call");
+ return array(false, false, "Error: unsuccessful API call");
}
// threshold defaults
@@ -156,7 +156,7 @@ function stopforumspam_is_spammer($username, $email, $ip) {
}
// return results
- return array($is_spammer, $reason);
+ return array(true, $is_spammer, $reason);
}
/**
diff --git a/htdocs/includes/usercp_register.php b/htdocs/includes/usercp_register.php
index 62c94e542..4de9bdf07 100644
--- a/htdocs/includes/usercp_register.php
+++ b/htdocs/includes/usercp_register.php
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: usercp_register.php,v 1.42 2013/01/12 13:48:20 tomk Exp $
+ * $Id: usercp_register.php,v 1.43 2013/02/25 10:39:07 tomk Exp $
*
*
***************************************************************************/
@@ -657,15 +657,65 @@ if ( isset($HTTP_POST_VARS['submit']) )
$spammer_reason = "language/timezone heuristics";
}
+ // 2013-08-06 tomk - Prevent 'England' spambot from registering
+ // https://forums.gentoo.org/viewtopic-p-6427295.html#6427295
+ if (! $is_spammer) {
+ if ($location == "England" && preg_match('/^[a-z]{3}\d{3}$/i', $jabber)) {
+ $is_spammer = TRUE;
+ $spammer_reason = "England spambot";
+ }
+ }
+
+ // 2013-08-06 tomk - Prevent 'Xrumer' spambot from registering
+ // https://forums.gentoo.org/viewtopic-p-7211256.html#7211256
+ if (! $is_spammer) {
+ if (preg_match('/^[0-9]+$/', $icq) &&
+ $location != '' &&
+ $occupation != '' &&
+ $interests != '' &&
+ $viewemail == TRUE &&
+ $allowviewonline == TRUE &&
+ $notifyreply == TRUE &&
+ $notifypm == TRUE &&
+ $popup_pm == TRUE &&
+ $attachsig == TRUE &&
+ $allowbbcode == TRUE &&
+ $allowhtml == TRUE &&
+ $allowsmilies == TRUE &&
+ $user_showavatars == TRUE &&
+ $aim == '' &&
+ $yim == '' &&
+ $msn == '' &&
+ $jabber == '') {
+ $is_spammer = TRUE;
+ $spammer_reason = "Xrumer spambot";
+ }
+ }
+
+ // 2013-08-06 tomk - Prevent 'Nowe Misato' spambot from registering
+ // https://forums.gentoo.org/viewtopic-p-6199243.html#6199243
+ if (! $is_spammer) {
+ if ($location == "Nowe Misato" && $occupation == "Technik") {
+ $is_spammer = TRUE;
+ $spammer_reason = "Nowe Misato spambot";
+ }
+ }
+
// 2011-01-31 tomk - stopforumspam.com functionality
include_once($phpbb_root_path . 'includes/stopforumspam.'.$phpEx);
if (! $is_spammer) {
$stopforumspam_check = stopforumspam_is_spammer($username, $email, decode_ip($user_ip));
- if (isset($stopforumspam_check) && count($stopforumspam_check) == 2) {
- $is_spammer = $stopforumspam_check[0];
- $spammer_reason = $stopforumspam_check[1];
+ if (isset($stopforumspam_check) && count($stopforumspam_check) == 3) {
+ $stopforumspam_up = $stopforumspam_check[0];
+ $is_spammer = $stopforumspam_check[1];
+ $spammer_reason = $stopforumspam_check[2];
+ }
+
+ // 2013-08-06 tomk - when SFS is down use admin activation
+ if (! $stopforumspam_up) {
+ $board_config['require_activation'] = USER_ACTIVATION_ADMIN;
}
}
@@ -994,34 +1044,40 @@ if ( isset($HTTP_POST_VARS['submit']) )
if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
- $sql = "SELECT user_email, user_lang
- FROM " . USERS_TABLE . "
- WHERE user_level = " . ADMIN;
+ // 2013-08-06 tomk - Send admin activation e-mails to f-mods instead of each admin
+ $sql = "SELECT config_name, config_value
+ FROM " . CONFIG_TABLE . "
+ WHERE config_name = 'default_lang'";
if ( !($result = $db->sql_query($sql)) )
{
- message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Could not select default language information', '', __LINE__, __FILE__, $sql);
}
+ $defaults = array();
while ($row = $db->sql_fetchrow($result))
{
- $emailer->from($board_config['board_email']);
- $emailer->replyto($board_config['board_email']);
-
- $emailer->email_address(trim($row['user_email']));
- $emailer->use_template("admin_activate", $row['user_lang']);
- $emailer->set_subject($lang['New_account_subject']);
-
- $emailer->assign_vars(array(
- 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
- 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
-
- 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
- );
- $emailer->send();
- $emailer->reset();
+ $defaults[$row['config_name']] = $row['config_value'];
}
$db->sql_freeresult($result);
+
+ $emailer->from($board_config['board_email']);
+ $emailer->replyto($board_config['board_email']);
+
+ $emailer->email_address($board_config['board_email']);
+ $emailer->use_template("admin_activate", $defaults['default_lang']);
+ $emailer->set_subject($lang['New_account_subject']);
+ $emailer->message_type(MTYPE_NEWACC);
+
+ $emailer->assign_vars(array(
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
+ 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
+
+ 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
+ );
+
+ $emailer->send();
+ $emailer->reset();
}
else if ( $board_config['require_activation'] == USER_ACTIVATION_WATCHED_IP )
{
diff --git a/sql/release_2-0-23-gentoo-p10.sql b/sql/release_2-0-23-gentoo-p10.sql
new file mode 100644
index 000000000..a2aa95b0e
--- /dev/null
+++ b/sql/release_2-0-23-gentoo-p10.sql
@@ -0,0 +1 @@
+UPDATE phpbb_config SET config_value = '.0.23-gentoo-p10' WHERE config_name = 'version';