aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2009-03-17 16:04:58 +0000
committerHenry Sudhof <kellanved@phpbb.com>2009-03-17 16:04:58 +0000
commit01078bb2fa8795e495e356a66676cb36dd3b0cd1 (patch)
treea43b1e6cedf96adb399982aa1e1cf76757cd680c
parent1e36ed1f741631be7c3c097b1a1cdd0db72baccb (diff)
downloadforums-01078bb2fa8795e495e356a66676cb36dd3b0cd1.tar
forums-01078bb2fa8795e495e356a66676cb36dd3b0cd1.tar.gz
forums-01078bb2fa8795e495e356a66676cb36dd3b0cd1.tar.bz2
forums-01078bb2fa8795e495e356a66676cb36dd3b0cd1.tar.xz
forums-01078bb2fa8795e495e356a66676cb36dd3b0cd1.zip
captcha changes
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9390 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/adm/style/acp_captcha.html13
-rw-r--r--phpBB/includes/acp/acp_captcha.php2
-rw-r--r--phpBB/includes/ucp/ucp_register.php36
-rw-r--r--phpBB/install/database_update.php4
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/board.php10
-rw-r--r--phpBB/language/en/ucp.php3
-rw-r--r--phpBB/styles/prosilver/template/ucp_register.html5
-rw-r--r--phpBB/styles/subsilver2/template/ucp_register.html4
9 files changed, 66 insertions, 13 deletions
diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html
index 83d47c193a..8a067cda66 100644
--- a/phpBB/adm/style/acp_captcha.html
+++ b/phpBB/adm/style/acp_captcha.html
@@ -22,6 +22,11 @@
<dd><label><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
<label><input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
</dl>
+<dl>
+ <dt><label for="confirm_refresh">{L_VISUAL_CONFIRM_REFRESH}:</label><br /><span>{L_VISUAL_CONFIRM_REFRESH_EXPLAIN}</span></dt>
+ <dd><label><input type="radio" class="radio" id="confirm_refresh" name="confirm_refresh" value="1"<!-- IF CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
+ <label><input type="radio" class="radio" name="confirm_refresh" value="0"<!-- IF not CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
+</dl>
<!-- IF GD -->
<dl>
<dt><label for="captcha_gd">{L_CAPTCHA_GD}:</label><br /><span>{L_CAPTCHA_GD_EXPLAIN}</span></dt>
@@ -53,6 +58,14 @@
<label><input name="captcha_gd_3d_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_3D_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
+<dl>
+ <dt><label for="captcha_gd_fonts">{L_CAPTCHA_GD_FONTS}:</label><br /><span>{L_CAPTCHA_GD_FONTS_EXPLAIN}</span></dt>
+ <dd><label><input id="captcha_gd_fonts" name="captcha_gd_fonts" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 1 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_DEFAULT}</label>
+ <label><input name="captcha_gd_fonts" value="2" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 2 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_NEW}</label>
+ <label><input name="captcha_gd_fonts" value="3" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 3 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_LOWER}</label>
+
+</dd>
+</dl>
<!-- ENDIF -->
</fieldset>
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index 4d5c356fbe..ac791dc098 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -35,6 +35,7 @@ class acp_captcha
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED',
'captcha_gd_wave' => 'CAPTCHA_GD_WAVE',
'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE',
+ 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS',
);
@@ -61,6 +62,7 @@ class acp_captcha
$config_vars = array(
'enable_confirm' => 'REG_ENABLE',
'enable_post_confirm' => 'POST_ENABLE',
+ 'confirm_refresh' => 'CONFIRM_REFRESH',
'captcha_gd' => 'CAPTCHA_GD',
);
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 315d24d47f..4ac5ae151b 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -37,12 +37,13 @@ class ucp_register
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
- $confirm_id = request_var('confirm_id', '');
- $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
- $agreed = (!empty($_POST['agreed'])) ? 1 : 0;
- $submit = (isset($_POST['submit'])) ? true : false;
- $change_lang = request_var('change_lang', '');
- $user_lang = request_var('lang', $user->lang_name);
+ $confirm_id = request_var('confirm_id', '');
+ $confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false;
+ $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
+ $agreed = (!empty($_POST['agreed'])) ? 1 : 0;
+ $submit = (isset($_POST['submit'])) ? true : false;
+ $change_lang = request_var('change_lang', '');
+ $user_lang = request_var('lang', $user->lang_name);
if ($agreed)
{
@@ -448,7 +449,7 @@ class ucp_register
if ($config['enable_confirm'])
{
- if ($change_lang)
+ if ($change_lang || $confirm_refresh)
{
$str = '&amp;change_lang=' . $change_lang;
$sql = 'SELECT code
@@ -467,7 +468,7 @@ class ucp_register
{
$str = '';
}
- if (!$change_lang || !$confirm_id)
+ if (!$change_lang || !$confirm_id || !$confirm_refresh)
{
$user->confirm_gc(CONFIRM_REG);
@@ -500,6 +501,24 @@ class ucp_register
);
$db->sql_query($sql);
}
+ else if ($confirm_refresh)
+ {
+ $code = gen_rand_string(mt_rand(5, 8));
+ $confirm_id = md5(unique_id($user->ip));
+ $seed = hexdec(substr(unique_id(), 4, 10));
+ // compute $seed % 0x7fffffff
+ $seed -= 0x7fffffff * floor($seed / 0x7fffffff);
+ $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
+ 'confirm_type' => (int) CONFIRM_REG,
+ 'code' => (string) $code,
+ 'seed' => (int) $seed) . "
+ WHERE
+ confirm_id = '" . $db->sql_escape($confirm_id) . "' AND
+ session_id = '" . $db->sql_escape($session_id) . "' AND
+ confirm_type = " . (int) CONFIRM_REG
+ );
+ $db->sql_query($sql);
+ }
$confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&amp;id=' . $confirm_id . '&amp;type=' . CONFIRM_REG . $str) . '" alt="" title="" />';
$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
}
@@ -534,6 +553,7 @@ class ucp_register
'S_LANG_OPTIONS' => language_select($data['lang']),
'S_TZ_OPTIONS' => tz_select($data['tz']),
'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false,
+ 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
'S_COPPA' => $coppa,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index f805d19d38..ca94bf03a9 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -893,6 +893,10 @@ function change_database_data(&$no_updates, $version)
set_config('captcha_gd_wave', 0);
set_config('captcha_gd_3d_noise', 1);
+ set_config('captcha_gd_fonts', 1);
+ set_config('confirm_refresh', 1);
+
+
$sql = 'SELECT user_id, user_password
FROM ' . USERS_TABLE . '
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 5072b19056..dd187d6958 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -66,6 +66,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_fonts', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0');
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 24ecb5f8a3..da3b067e27 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -247,13 +247,21 @@ $lang = array_merge($lang, array(
'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the CAPTCHA.',
'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects',
'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the CAPTCHA, over the letters.',
-
+ 'CAPTCHA_GD_FONTS' => 'Use different fonts',
+ 'CAPTCHA_GD_FONTS_EXPLAIN' => 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.',
+ 'CAPTCHA_FONT_DEFAULT' => 'Default',
+ 'CAPTCHA_FONT_NEW' => 'New Shapes',
+ 'CAPTCHA_FONT_LOWER' => 'Also use lowercase',
+
+
'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.',
'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.',
'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings',
'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.',
'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations',
'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to enter a random code matching an image to help prevent mass registrations.',
+ 'VISUAL_CONFIRM_REFRESH' => 'Enable users to request new images',
+ 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request new images, if they are unable to solve the VC.',
));
// Cookie Settings
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 27287271a7..0c26e612e3 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -122,6 +122,9 @@ $lang = array_merge($lang, array(
'CONFIRM_EMAIL' => 'Confirm e-mail address',
'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your e-mail address.',
'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
+ 'VC_REFRESH' => 'New Image',
+ 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code, then you can request a new one by clicking the button.',
+
'CONFIRM_PASSWORD' => 'Confirm password',
'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above.',
'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.',
diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html
index 721028cef6..3aeb92a5b0 100644
--- a/phpBB/styles/prosilver/template/ucp_register.html
+++ b/phpBB/styles/prosilver/template/ucp_register.html
@@ -87,7 +87,8 @@
<dt><label for="confirm_code">{L_CONFIRM_CODE}:</label></dt>
<dd>{CONFIRM_IMG}</dd>
<dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" class="inputbox narrow" title="{L_CONFIRM_CODE}" /></dd>
- <dd>{L_CONFIRM_CODE_EXPLAIN}</dd>
+ <dd>{L_CONFIRM_CODE_EXPLAIN}<!-- IF S_CONFIRM_REFRESH --> {L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></dd>
+ <!-- IF S_CONFIRM_REFRESH --><dd><input type="submit" value="{L_VC_REFRESH}" class="button2" /></dd> <!-- ENDIF -->
</dl>
</fieldset>
<!-- ENDIF -->
@@ -113,7 +114,7 @@
<fieldset class="submit-buttons">
{S_HIDDEN_FIELDS}
<input type="reset" value="{L_RESET}" name="reset" class="button2" />&nbsp;
- <input type="submit" name="submit" id ="submit" value="{L_SUBMIT}" class="button1" />
+ <input type="submit" name="submit" id="submit" value="{L_SUBMIT}" class="button1" />
{S_FORM_TOKEN}
</fieldset>
diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html
index dac9283b28..fd987f2d73 100644
--- a/phpBB/styles/subsilver2/template/ucp_register.html
+++ b/phpBB/styles/subsilver2/template/ucp_register.html
@@ -88,8 +88,8 @@
<td class="row1" colspan="2" align="center">{CONFIRM_IMG}</td>
</tr>
<tr>
- <td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
- <td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /></td>
+ <td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN} <!-- IF S_CONFIRM_REFRESH -->{L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></span></td>
+ <td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /><!-- IF S_CONFIRM_REFRESH -->&nbsp;<input type="submit" value="{L_VC_REFRESH}" class="btnlite" /><!-- ENDIF --></td>
</tr>
<!-- ENDIF -->