[phpBB] svn: r302 - in trunk/phpbb2: . patches

kink at wolffelaar.nl kink at wolffelaar.nl
Fri Jul 7 13:05:17 CEST 2006


Author: kink
Date: 2006-07-07 13:05:16 +0200 (Fri, 07 Jul 2006)
New Revision: 302

Added:
   trunk/phpbb2/patches/050_visual_confirm_for_guest_posts.diff
Removed:
   trunk/phpbb2/patches/050_XXX_visual_confirm_for_guest_posts.XXXdiff
Modified:
   trunk/phpbb2/changelog
Log:
  * Enable previously disabled patch for visual confirmation (capthca)
    for guest posting, in an attempt to reduce spam (Closes: #372081).


Modified: trunk/phpbb2/changelog
===================================================================
--- trunk/phpbb2/changelog	2006-07-06 18:18:35 UTC (rev 301)
+++ trunk/phpbb2/changelog	2006-07-07 11:05:16 UTC (rev 302)
@@ -1,8 +1,9 @@
 phpbb2 (2.0.21-2) unstable; urgency=low
 
-  * 
+  * Enable previously disabled patch for visual confirmation (capthca)
+    for guest posting, in an attempt to reduce spam (Closes: #372081).
 
- -- Thijs Kinkhorst <thijs at debian.org>  Thu,  6 Jul 2006 20:14:24 +0200
+ -- Thijs Kinkhorst <thijs at debian.org>  Fri,  7 Jul 2006 13:03:44 +0200
 
 phpbb2 (2.0.21-1) unstable; urgency=low
 

Deleted: trunk/phpbb2/patches/050_XXX_visual_confirm_for_guest_posts.XXXdiff
===================================================================
--- trunk/phpbb2/patches/050_XXX_visual_confirm_for_guest_posts.XXXdiff	2006-07-06 18:18:35 UTC (rev 301)
+++ trunk/phpbb2/patches/050_XXX_visual_confirm_for_guest_posts.XXXdiff	2006-07-07 11:05:16 UTC (rev 302)
@@ -1,179 +0,0 @@
-diff -ur phpBB2.orig/posting.php phpBB2/posting.php
---- phpBB2.orig/posting.php	2006-06-09 16:29:43.000000000 +0200
-+++ phpBB2/posting.php	2006-07-03 13:29:44.000000000 +0200
-@@ -20,6 +20,12 @@
-  *
-  ***************************************************************************/
- 
-+/*
-+
-+	png visual confirmation system : (c) phpBB Group, 2003 : All Rights Reserved
-+
-+*/
-+
- define('IN_PHPBB', true);
- $phpbb_root_path = './';
- include($phpbb_root_path . 'extension.inc');
-@@ -547,6 +553,56 @@
- 		case 'editpost':
- 		case 'newtopic':
- 		case 'reply':
-+			if ( $board_config['enable_confirm'] && !$userdata['session_logged_in'] )
-+			{
-+				if ( empty($HTTP_POST_VARS['confirm_id']) || empty($HTTP_POST_VARS['confirm_code']) )
-+				{
-+					$error = TRUE;
-+					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
-+				}
-+				else
-+				{
-+					$confirm_id = htmlspecialchars($HTTP_POST_VARS['confirm_id']);
-+					if (!preg_match('/^[A-Za-z0-9]+$/', $confirm_id))
-+					{
-+						$confirm_id = '';
-+					}
-+					
-+					$sql = 'SELECT code 
-+						FROM ' . CONFIRM_TABLE . " 
-+						WHERE confirm_id = '$confirm_id' 
-+							AND session_id = '" . $userdata['session_id'] . "'";
-+					if (!($result = $db->sql_query($sql)))
-+					{
-+						message_die(GENERAL_ERROR, 'Could not obtain confirmation code', __LINE__, __FILE__, $sql);
-+					}
-+		
-+					if ($row = $db->sql_fetchrow($result))
-+					{
-+						if ($row['code'] != $HTTP_POST_VARS['confirm_code'])
-+						{
-+							$error = TRUE;
-+							$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
-+						}
-+						else
-+						{
-+							$sql = 'DELETE FROM ' . CONFIRM_TABLE . " 
-+								WHERE confirm_id = '$confirm_id' 
-+									AND session_id = '" . $userdata['session_id'] . "'";
-+							if (!$db->sql_query($sql))
-+							{
-+								message_die(GENERAL_ERROR, 'Could not delete confirmation code', __LINE__, __FILE__, $sql);
-+							}
-+						}
-+					}
-+					else
-+					{		
-+						$error = TRUE;
-+						$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Confirm_code_wrong'];
-+					}
-+					$db->sql_freeresult($result);
-+				}
-+			}
- 			$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
- 			$subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : '';
- 			$message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
-@@ -948,6 +1004,66 @@
- 		break;
- }
- 
-+//
-+// Visual confirmation for guests
-+//
-+$confirm_image = '';
-+if( !$userdata['session_logged_in'] && (!empty($board_config['enable_confirm'])) )
-+{
-+	$sql = 'SELECT session_id 
-+		FROM ' . SESSIONS_TABLE; 
-+	if (!($result = $db->sql_query($sql)))
-+	{
-+		message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql);
-+	}
-+	
-+	if ($row = $db->sql_fetchrow($result))
-+	{
-+		$confirm_sql = '';
-+		do
-+		{
-+			$confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'";
-+		}
-+		while ($row = $db->sql_fetchrow($result));
-+	
-+		$sql = 'DELETE FROM ' .  CONFIRM_TABLE . " 
-+			WHERE session_id NOT IN ($confirm_sql)";
-+		if (!$db->sql_query($sql))
-+		{
-+			message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
-+		}
-+	}
-+	$db->sql_freeresult($result);
-+	
-+	$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
-+	
-+	list($usec, $sec) = explode(' ', microtime()); 
-+	mt_srand($sec * $usec); 
-+	
-+	$max_chars = count($confirm_chars) - 1;
-+	$code = '';
-+	for ($i = 0; $i < 6; $i++)
-+	{
-+		$code .= $confirm_chars[mt_rand(0, $max_chars)];
-+	}
-+	
-+	$confirm_id = md5(uniqid($user_ip));
-+	
-+	$sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code) 
-+		VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')";
-+	if (!$db->sql_query($sql))
-+	{
-+		message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql);
-+	}
-+	
-+	unset($code);
-+	
-+	$confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />';
-+	$hidden_form_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
-+	
-+	$template->assign_block_vars('switch_confirm', array());
-+}
-+
- // Generate smilies listing for page output
- generate_smilies('inline', PAGE_POSTING);
- 
-@@ -987,6 +1103,7 @@
- 	'HTML_STATUS' => $html_status,
- 	'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 
- 	'SMILIES_STATUS' => $smilies_status, 
-+	'CONFIRM_IMG' => $confirm_image,
- 
- 	'L_SUBJECT' => $lang['Subject'],
- 	'L_MESSAGE_BODY' => $lang['Message_body'],
-@@ -1002,6 +1119,9 @@
- 	'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], 
- 	'L_NOTIFY_ON_REPLY' => $lang['Notify'], 
- 	'L_DELETE_POST' => $lang['Delete_post'],
-+	'L_CONFIRM_CODE_IMPAIRED'	=> sprintf($lang['Confirm_code_impaired'], '<a href="mailto:' . $board_config['board_email'] . '">', '</a>'),
-+	'L_CONFIRM_CODE' => $lang['Confirm_code'],
-+	'L_CONFIRM_CODE_EXPLAIN' => $lang['Confirm_code_explain'],
- 
- 	'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], 
- 	'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], 
-Only in phpBB2: posting.php.orig
-diff -ur phpBB2.orig/templates/subSilver/posting_body.tpl phpBB2/templates/subSilver/posting_body.tpl
---- phpBB2.orig/templates/subSilver/posting_body.tpl	2006-06-09 16:29:42.000000000 +0200
-+++ phpBB2/templates/subSilver/posting_body.tpl	2006-07-03 13:29:44.000000000 +0200
-@@ -460,6 +460,16 @@
- 	  </td>
- 	</tr>
- 	{POLLBOX} 
-+	<!-- Visual Confirmation -->
-+	<!-- BEGIN switch_confirm -->
-+	<tr>
-+		<td class="row1" colspan="2" align="center"><span class="gensmall">{L_CONFIRM_CODE_IMPAIRED}</span><br /><br />{CONFIRM_IMG}<br /><br /></td>
-+	</tr>
-+	<tr> 
-+	  <td class="row1"><span class="gen">{L_CONFIRM_CODE}: * </span><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
-+	  <td class="row2"><input type="text" class="post" style="width: 200px" name="confirm_code" size="6" maxlength="6" value="" /></td>
-+	</tr>
-+	<!-- END switch_confirm -->
- 	<tr> 
- 	  <td class="catBottom" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" />&nbsp;<input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>
- 	</tr>

Copied: trunk/phpbb2/patches/050_visual_confirm_for_guest_posts.diff (from rev 301, trunk/phpbb2/patches/050_XXX_visual_confirm_for_guest_posts.XXXdiff)





More information about the phpBB-l mailing list