Index: include/spam.php =================================================================== --- include/spam.php (revision 0) +++ include/spam.php (revision 0) -0,0 +1,113 @@ + array( + 'method' => 'POST', + 'header' => 'User-Agent: FluxBB/'.$pun_config['o_board_version'].' | NoSpam/'.NOSPAM_VERSION."\r\n", + 'content' => $request, + ) + )); + + $result = @file_get_contents($url, FILE_TEXT, $context); + if ($result === false) + return false; + + return trim($result); +} Index: lang/English/spam.php =================================================================== --- lang/English/spam.php (revision 0) +++ lang/English/spam.php (revision 0) -0,0 +1,17 @@ + 'Sorry, our anti-spam system appears to have decided you are a spammer! If you feel this is incorrect please contact the board admin at 'NoSpam installed. Redirecting …', +); Index: plugins/AP_NoSpam.php =================================================================== --- plugins/AP_NoSpam.php (revision 0) +++ plugins/AP_NoSpam.php (revision 0) -0,0 +1,119 @@ +query('INSERT INTO '.$db->prefix.'config(conf_name, conf_value) VALUES(\'o_enable_nospam\', \'1\')') or error('Unable to insert settings', __FILE__, __LINE__, $db->error()); + $db->query('INSERT INTO '.$db->prefix.'config(conf_name, conf_value) VALUES(\'o_akismet_key\', \'\')') or error('Unable to insert settings', __FILE__, __LINE__, $db->error()); + + // Regenerate the config cache + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) + require PUN_ROOT.'include/cache.php'; + + generate_config_cache(); + + redirect($_SERVER['REQUEST_URI'], $lang_spam['Install redirect']); + } + + // Display the admin navigation menu + generate_admin_menu($plugin); + +?> +
+

+
+
+
+

+
+

+
+
+
+query('UPDATE '.$db->prefix.'config SET conf_value=\''.$enable.'\' WHERE conf_name=\'o_enable_nospam\'') or error('Unable to update settings', __FILE__, __LINE__, $db->error()); + + if ($api_key != $pun_config['o_akismet_key']) + $db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$api_key.'\' WHERE conf_name=\'o_akismet_key\'') or error('Unable to update settings', __FILE__, __LINE__, $db->error()); + + // Regenerate the config cache + if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) + require PUN_ROOT.'include/cache.php'; + + generate_config_cache(); + + redirect($_SERVER['REQUEST_URI'], $lang_spam['Settings updated']); + } + + // Display the admin navigation menu + generate_admin_menu($plugin); + +?> +
+

+
+
+
+

Suspected spammer') ?>

+ +
+ +
+ + + + + + + + + +
+ />     />  + +
+ + http://akismet.com') ?> +
+
+
+
+

+
+
+
+query('UPDATE users SET admin_note=\'Suspected spammer\' WHERE id='.$pun_user['id'].' AND admin_note IS NULL') or error('Unable to mark spammer', __FILE__, __LINE__, $db->error()); + + $errors[] = sprintf($lang_spam['Spam error'], '
'.$pun_config['o_admin_email'].''); + } + // Validate BBCode syntax if ($pun_config['p_message_bbcode'] == '1') { Index: profile.php =================================================================== --- profile.php (revision 1388) +++ profile.php (working copy) -646,11 +646,11 @@ else if (isset($_POST['form_sent'])) { // Fetch the user group of the user we are editing - $result = $db->query('SELECT u.group_id, g.g_moderator FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); + $result = $db->query('SELECT u.group_id, g.g_moderator, u.username, u.email FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON (g.g_id=u.group_id) WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); - list($group_id, $is_moderator) = $db->fetch_row($result); + list($group_id, $is_moderator, $username, $email) = $db->fetch_row($result); if ($pun_user['id'] != $id && (!$pun_user['is_admmod'] || -801,6 +801,15 @@ else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$pun_user['is_admmod']) $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature'])); + require PUN_ROOT.'include/spam.php'; + + // Check if it is spam (only if the person editing isnt an admin/mod) + if (!$pun_user['is_admmod'] && spam_check(get_remote_address(), $username, $email, $form['signature'])) + { + $db->query('UPDATE users SET admin_note=\'Suspected spammer\' WHERE id='.$id.' AND admin_note IS NULL') or error('Unable to mark spammer', __FILE__, __LINE__, $db->error()); + message(sprintf($lang_spam['Spam error'], ''.$pun_config['o_admin_email'].'')); + } + // Validate BBCode syntax if ($pun_config['p_sig_bbcode'] == '1') { Index: register.php =================================================================== --- register.php (revision 1388) +++ register.php (working copy) -170,6 +170,12 @@ $dupe_list[] = $cur_dupe['username']; } + // Check if it is spam + require PUN_ROOT.'include/spam.php'; + + if (spam_check(get_remote_address(), $username, $email1)) + $errors[] = sprintf($lang_spam['Spam error'], ''.$pun_config['o_admin_email'].''); + // Make sure we got a valid language string if (isset($_POST['language'])) {