aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2009-02-08 14:15:49 +0000
committerHenry Sudhof <kellanved@phpbb.com>2009-02-08 14:15:49 +0000
commit6f486b0499258d1a236837acae120274bb1832d1 (patch)
tree78aca5d7a4b321aee41032556b7208a9c40034f8 /phpBB
parent12c605755f933761e29b5c357298f9287b18e342 (diff)
downloadforums-6f486b0499258d1a236837acae120274bb1832d1.tar
forums-6f486b0499258d1a236837acae120274bb1832d1.tar.gz
forums-6f486b0499258d1a236837acae120274bb1832d1.tar.bz2
forums-6f486b0499258d1a236837acae120274bb1832d1.tar.xz
forums-6f486b0499258d1a236837acae120274bb1832d1.zip
and another CAPTCHA setting - add new noise shapes to the noise array for more variations.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9320 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_captcha.html6
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/includes/acp/acp_captcha.php3
-rw-r--r--phpBB/includes/captcha/captcha_gd.php63
-rw-r--r--phpBB/install/database_update.php2
-rw-r--r--phpBB/install/schemas/schema_data.sql1
-rw-r--r--phpBB/language/en/acp/board.php4
7 files changed, 77 insertions, 3 deletions
diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html
index bbee371b2a..e8e5bd2265 100644
--- a/phpBB/adm/style/acp_captcha.html
+++ b/phpBB/adm/style/acp_captcha.html
@@ -47,6 +47,12 @@
<label><input name="captcha_gd_wave" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_WAVE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
+<dl>
+ <dt><label for="captcha_gd_3d_noise">{L_CAPTCHA_GD_3D_NOISE}:</label><br /><span>{L_CAPTCHA_GD_3D_NOIS_EXPLAIN}</span></dt>
+ <dd><label><input id="captcha_gd_3d_noise" name="captcha_gd_3d_noise" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_3D_NOISE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+ <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>
<!-- ENDIF -->
</fieldset>
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index cf5953d279..6ae275301f 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -100,6 +100,7 @@
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
+ <li>[Change] Added new options for visual confirmation.</li>
</ul>
<a name="v303"></a><h3>1.ii. Changes since 3.0.3</h3>
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index 8b5cf19ee7..4d5c356fbe 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -28,13 +28,14 @@ class acp_captcha
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/board');
-
$captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE',
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED',
'captcha_gd_wave' => 'CAPTCHA_GD_WAVE',
+ 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE',
+
);
if (isset($_GET['demo']))
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index 04a449bfde..9587e87b4f 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -53,11 +53,12 @@ class captcha
$bg_colours = array_splice($scheme, mt_rand(6, 12));
// Generate code characters
- $characters = $sizes = $bounding_boxes = array();
+ $characters = $sizes = $bounding_boxes = $noise = array();
$width_avail = $this->width - 15;
$code_len = strlen($code);
$captcha_bitmaps = $this->captcha_bitmaps();
+ $noise_bitmaps = $this->captcha_noise_bitmaps();
for ($i = 0; $i < $code_len; ++$i)
{
$characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]);
@@ -70,6 +71,7 @@ class captcha
$bounding_boxes[$i] = $box;
}
+
// Redistribute leftover x-space
$offset = array();
for ($i = 0; $i < $code_len; ++$i)
@@ -110,6 +112,26 @@ class captcha
$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
}
+ if ($config['captcha_gd_3d_noise'])
+ {
+ for ($i = 0; $i < $code_len; ++$i)
+ {
+ $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, 1 + count($noise_bitmaps)));
+
+ list($min, $max) = $noise[$i]->range();
+ //$box = $noise[$i]->dimensions($sizes[$i]);
+ }
+ $xoffset = 0;
+ for ($i = 0; $i < $code_len; ++$i)
+ {
+ $dimm = $bounding_boxes[$i];
+ $xoffset += ($offset[$i] - $dimm[0]);
+ $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]);
+
+ $noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
+ $xoffset += $dimm[2];
+ }
+ }
if ($config['captcha_gd_wave'])
{
$this->wave($img);
@@ -206,6 +228,45 @@ class captcha
imagesetthickness($img, 1);
}
+
+ function captcha_noise_bitmaps()
+ {
+ return array(
+ 'width' => 9,
+ 'height' => 5,
+ 'data' => array(
+
+ 1 => array(
+ array(1,0,0,0,1,0,0,0,0),
+ array(1,0,0,0,0,1,0,0,0),
+ array(1,0,0,0,0,1,0,0,0),
+ array(1,0,0,0,0,1,0,0,0),
+ array(1,0,0,0,0,0,1,0,0),
+ ),
+ 2 => array(
+ array(1,1,1,1,1,1,1,1,1),
+ array(0,0,0,0,0,0,0,1,0),
+ array(0,0,0,0,0,0,0,0,0),
+ array(0,0,0,0,0,0,0,0,0),
+ array(0,0,0,0,0,0,0,0,0),
+ ),
+ 3 => array(
+ array(1,0,0,0,0,0,0,0,0),
+ array(1,0,0,0,0,0,0,0,0),
+ array(1,0,0,0,0,0,0,0,0),
+ array(1,0,0,0,0,0,0,0,0),
+ array(1,0,0,0,0,0,0,0,0),
+ ),
+ 4 => array(
+ array(1,0,1,0,1,0,0,1,1),
+ array(0,0,0,0,0,0,0,1,0),
+ array(1,0,1,0,1,0,1,0,0),
+ array(0,0,0,0,0,0,0,0,0),
+ array(1,0,1,0,1,0,1,0,0),
+ ),
+ ));
+ }
+
/**
* Return bitmaps
*/
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index ff6579d2ed..18a94b3219 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -2043,6 +2043,8 @@ function change_database_data(&$no_updates, $version)
case '3.0.4':
set_config('captcha_gd_wave', 0);
+ set_config('captcha_gd_3d_noise', 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 3e59855736..5072b19056 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -65,6 +65,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foregro
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25');
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 ('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 bb999d84ac..24ecb5f8a3 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -245,7 +245,9 @@ $lang = array_merge($lang, array(
'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable y-axis background noise.',
'CAPTCHA_GD_WAVE' => 'GD CAPTCHA wave distortion',
'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_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',