bugs? bugs.

git-svn-id: file:///svn/phpbb/trunk@6133 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-07-01 06:30:49 +00:00
parent 30563df345
commit 3efe7ffb1f
7 changed files with 31 additions and 28 deletions

View file

@ -45,7 +45,7 @@
<br /> <br />
<table cellspacing="1"> <table cellspacing="1" id="down">
<thead> <thead>
<tr> <tr>
<th colspan="2">{L_TOKENS}</th> <th colspan="2">{L_TOKENS}</th>
@ -76,7 +76,7 @@
<p>{L_ACP_BBCODES_EXPLAIN}</p> <p>{L_ACP_BBCODES_EXPLAIN}</p>
<table cellspacing="1"> <table cellspacing="1" id="down">
<thead> <thead>
<tr> <tr>
<th>{L_BBCODE_TAG}</th> <th>{L_BBCODE_TAG}</th>

View file

@ -89,6 +89,7 @@ class acp_bbcodes
'U_BACK' => $this->u_action, 'U_BACK' => $this->u_action,
'U_ACTION' => $this->u_action . '&amp;action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&amp;bbcode=$bbcode_id" : ''), 'U_ACTION' => $this->u_action . '&amp;action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&amp;bbcode=$bbcode_id" : ''),
'L_BBCODE_USAGE_EXPLAIN'=> sprintf($user->lang['BBCODE_USAGE_EXPLAIN'], '<a href="#down">', '</a>'),
'BBCODE_MATCH' => $bbcode_match, 'BBCODE_MATCH' => $bbcode_match,
'BBCODE_TPL' => $bbcode_tpl, 'BBCODE_TPL' => $bbcode_tpl,
'DISPLAY_ON_POSTING' => $display_on_posting) 'DISPLAY_ON_POSTING' => $display_on_posting)
@ -278,8 +279,8 @@ class acp_bbcodes
{ {
$token_type = $m[1][$n]; $token_type = $m[1][$n];
reset($tokens[$token_type]); reset($tokens[strtoupper($token_type)]);
list($match, $replace) = each($tokens[$token_type]); list($match, $replace) = each($tokens[strtoupper($token_type)]);
// Pad backreference numbers from tokens // Pad backreference numbers from tokens
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad)) if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
@ -337,7 +338,7 @@ class acp_bbcodes
} }
// Lowercase tags // Lowercase tags
$bbcode_tag = preg_replace('/.*?\[([a-z]+=?).*/i', '$1', $bbcode_match); $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match);
$fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match); $fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match);
$fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace); $fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace);
$sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match); $sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match);

View file

@ -99,6 +99,8 @@ class acp_captcha
trigger_error($user->lang['BAD_POLICY']); trigger_error($user->lang['BAD_POLICY']);
} }
$user->add_lang('ucp');
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
$captcha = new captcha(); $captcha = new captcha();

View file

@ -42,7 +42,7 @@ class acp_database
$type = request_var('type', ''); $type = request_var('type', '');
$table = request_var('table', array('')); $table = request_var('table', array(''));
$format = request_var('method', ''); $format = request_var('method', '');
$where = request_var('WHERE', ''); $where = request_var('where', '');
$store = $download = $structure = $schema_data = false; $store = $download = $structure = $schema_data = false;

View file

@ -97,7 +97,7 @@ class captcha
$char = hexdec(substr($seed, ($y * 4) + $x, 1)); $char = hexdec(substr($seed, ($y * 4) + $x, 1));
if (!($char >> 2)) if (!($char >> 2))
{ {
switch ($char % 4) switch ($char & 3)
{ {
case 0: case 0:
$shape = 'Circle'; $shape = 'Circle';
@ -125,20 +125,20 @@ class captcha
for ($i = 0; $i < 6; ++$i) for ($i = 0; $i < 6; ++$i)
{ {
$cells = hexdec(substr($seed, 20 + ($i * 2), 2)); $cells = hexdec(substr($seed, 20 + ($i * 2), 2));
$x1 = $cells % 4; $x1 = $cells & 3;
$cells = $cells >> 2; $cells = $cells >> 2;
$y1 = $cells % 4; $y1 = $cells & 3;
$cells = $cells >> 2; $cells = $cells >> 2;
$x2 = $cells % 4; $x2 = $cells & 3;
$cells = $cells >> 2; $cells = $cells >> 2;
$y2 = $cells % 4; $y2 = $cells & 3;
$x1_real = $x_min + (($x1 + 0.5) * $x_size); $x1_real = $x_min + (($x1 + 0.5) * $x_size);
$y1_real = $y_min + (($y1 + 0.5) * $y_size); $y1_real = $y_min + (($y1 + 0.5) * $y_size);
$x2_real = $x_min + (($x2 + 0.5) * $x_size); $x2_real = $x_min + (($x2 + 0.5) * $x_size);
$y2_real = $y_min + (($y2 + 0.5) * $y_size); $y2_real = $y_min + (($y2 + 0.5) * $y_size);
if ($thickness > 1) if ($thickness > 1)
{ {
imagesetthickness($img,$thickness); imagesetthickness($img, $thickness);
} }
imageline($img, $x1_real, $y1_real, $x2_real, $y2_real, $colors[array_rand($colors)]); imageline($img, $x1_real, $y1_real, $x2_real, $y2_real, $colors[array_rand($colors)]);
if ($thickness > 1) if ($thickness > 1)
@ -203,7 +203,7 @@ class captcha
$patterns = array('', '', '', ''); $patterns = array('', '', '', '');
for ($i = 32; $i > 0; --$i) for ($i = 32; $i > 0; --$i)
{ {
$patterns[$i % 4] .= str_pad(dechex(mt_rand(0, 65535)), 4, '0', STR_PAD_LEFT); $patterns[$i & 3] .= str_pad(dechex(mt_rand(0, 65535)), 4, '0', STR_PAD_LEFT);
} }
$char_class = $this->captcha_char('char_ttf'); $char_class = $this->captcha_char('char_ttf');
@ -341,11 +341,11 @@ class captcha
{ {
$distance = min($distance, sqrt(pow($s, 2) + pow($r, 2))); $distance = min($distance, sqrt(pow($s, 2) + pow($r, 2)));
} }
elseif ($s < $vector[6]) else if ($s < $vector[6])
{ {
$distance = min($distance, $r); $distance = min($distance, $r);
} }
elseif ($s < $vector[6] + $range) else if ($s < $vector[6] + $range)
{ {
$distance = min($distance, sqrt(pow($s - $vector[6], 2) + pow($r, 2))); $distance = min($distance, sqrt(pow($s - $vector[6], 2) + pow($r, 2)));
} }
@ -358,7 +358,7 @@ class captcha
$dx = $meta_x - $vector[1]; $dx = $meta_x - $vector[1];
$dy = -($meta_y - $vector[2]); // because our arcs are upside-down $dy = -($meta_y - $vector[2]); // because our arcs are upside-down
if ( abs($dx) > abs($dy) ) if (abs($dx) > abs($dy))
{ {
$phi = rad2deg(atan(($dy * $vector[3]) / ($dx * $vector[4]))); $phi = rad2deg(atan(($dy * $vector[3]) / ($dx * $vector[4])));
$phi += ($dx < 0) ? 180 : 360; $phi += ($dx < 0) ? 180 : 360;
@ -575,10 +575,10 @@ class captcha
{ {
for ($i = 0, $size = sizeof($spares[$k]); $i < $size; ++$i ) for ($i = 0, $size = sizeof($spares[$k]); $i < $size; ++$i )
{ {
imagefilledellipse($img, $xs[$spares[$k][$i]], $ys[$spares[$k][$i]], 20, 20, $colors[($red + $k + 1) % 4]); imagefilledellipse($img, $xs[$spares[$k][$i]], $ys[$spares[$k][$i]], 20, 20, $colors[($red + $k + 1) & 3]);
if ($i) if ($i)
{ {
imageline($img, $xs[$spares[$k][$i - 1]], $ys[$spares[$k][$i - 1]], $xs[$spares[$k][$i]], $ys[$spares[$k][$i]], $colors[($red + $k + 1) % 4]); imageline($img, $xs[$spares[$k][$i - 1]], $ys[$spares[$k][$i - 1]], $xs[$spares[$k][$i]], $ys[$spares[$k][$i]], $colors[($red + $k + 1) & 3]);
} }
} }
} }
@ -794,7 +794,7 @@ class captcha
{ {
if ($map['data'][$letter][$y][$x]) if ($map['data'][$letter][$y][$x])
{ {
$plane[$y + $plane_offset_y + (($c % 2) ? 1 : -1)][$x + $plane_offset_x] = true; $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true;
} }
} }
} }
@ -827,7 +827,7 @@ class captcha
for ($y = 1; $y <= $full_y; ++$y) for ($y = 1; $y <= $full_y; ++$y)
{ {
// swap buffers // swap buffers
$buffer_cur = $y % 2; $buffer_cur = $y & 1;
$buffer_prev = 1 - $buffer_cur; $buffer_prev = 1 - $buffer_cur;
$prev_height = $this->wave_height(0, $y, $subdivision_factor); $prev_height = $this->wave_height(0, $y, $subdivision_factor);
@ -869,7 +869,7 @@ class captcha
$diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old]));
// natural switching // natural switching
$mode = ($x + $y) % 2; $mode = ($x + $y) & 1;
// override if it requires it // override if it requires it
if ($diag_down != $diag_up) if ($diag_down != $diag_up)
@ -969,7 +969,7 @@ class captcha
$characters[$i]->drawchar($char_size, $offset, $yoffset, $img, $background, $fontcolors); $characters[$i]->drawchar($char_size, $offset, $yoffset, $img, $background, $fontcolors);
$offset += $dimm[2]; $offset += $dimm[2];
$offset -= (($dimm[2] - $dimm[0]) * $overlap_factor); $offset -= (($dimm[2] - $dimm[0]) * $overlap_factor);
$yoffset += ($i % 2) ? ((1 - $overlap_factor) * ($dimm[3] - $dimm[1])) : ((1 - $overlap_factor) * ($dimm[1] - $dimm[3])); $yoffset += ($i & 1) ? ((1 - $overlap_factor) * ($dimm[3] - $dimm[1])) : ((1 - $overlap_factor) * ($dimm[1] - $dimm[3]));
} }
// Add some medium pixel noise // Add some medium pixel noise
@ -1041,15 +1041,15 @@ class captcha
case 'noise_pixel_heavy': case 'noise_pixel_heavy':
for ($x = $min_x; $x < $max_x; $x += mt_rand(9, 18)) for ($x = $min_x; $x < $max_x; $x += mt_rand(4, 9))
{ {
for ($y = $min_y; $y < $max_y; $y += mt_rand(4, 9)) for ($y = $min_y; $y < $max_y; $y++)
{ {
imagesetpixel($img, $x, $y, $non_font[array_rand($non_font)]); imagesetpixel($img, $x, $y, $non_font[array_rand($non_font)]);
} }
} }
for ($y = $min_y; $y < $max_y; $y++) for ($y = $min_y; $y < $max_y; $y+= mt_rand(4, 9))
{ {
for ($x = $min_x; $x < $max_x; $x++) for ($x = $min_x; $x < $max_x; $x++)
{ {
@ -1145,7 +1145,7 @@ class captcha
$character_classes[] = 'char_ttf'; $character_classes[] = 'char_ttf';
} }
} }
//$character_classes = array('char_dots');
// Use the module $override, else a random picked one... // Use the module $override, else a random picked one...
$class = ($override !== false && in_array($override, $character_classes)) ? $override : $character_classes[array_rand($character_classes)]; $class = ($override !== false && in_array($override, $character_classes)) ? $override : $character_classes[array_rand($character_classes)];

View file

@ -59,7 +59,7 @@ class ucp_confirm
if (function_exists('imagettfbbox') && function_exists('imagettftext')) if (function_exists('imagettfbbox') && function_exists('imagettftext'))
{ {
$policy_modules += array('policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite'); $policy_modules = array_merge($policy_modules, array('policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite'));
} }
foreach ($policy_modules as $key => $name) foreach ($policy_modules as $key => $name)

View file

@ -41,7 +41,7 @@ $lang = array_merge($lang, array(
'BBCODE_TAG' => 'Tag', 'BBCODE_TAG' => 'Tag',
'BBCODE_USAGE' => 'BBCode usage', 'BBCODE_USAGE' => 'BBCode usage',
'BBCODE_USAGE_EXAMPLE' => '[colour={COLOR}]{TEXT}[/colour]<br /><br />[font={TEXT1}]{TEXT2}[/font]', 'BBCODE_USAGE_EXAMPLE' => '[colour={COLOR}]{TEXT}[/colour]<br /><br />[font={TEXT1}]{TEXT2}[/font]',
'BBCODE_USAGE_EXPLAIN' => 'Here you define how to use the bbcode. Replace any variable input by the corresponding token (see below)', 'BBCODE_USAGE_EXPLAIN' => 'Here you define how to use the bbcode. Replace any variable input by the corresponding token (%ssee below%s)',
'EXAMPLE' => 'Example:', 'EXAMPLE' => 'Example:',
'EXAMPLES' => 'Examples:', 'EXAMPLES' => 'Examples:',