mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
- compress is nicer (fixed a bug :P)
- UTF-8 code is nicer (fixed a bug :P) - new CAPTCHA. Replaced the old one for size and usability issues. The old CAPTCHA will most likely be released as a separate package git-svn-id: file:///svn/phpbb/trunk@6549 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7ab232a455
commit
8b0ec6e02d
12 changed files with 1423 additions and 4974 deletions
|
@ -18,100 +18,18 @@
|
||||||
<dt><label for="enable_post_confirm">{L_VISUAL_CONFIRM_POST}:</label><br /><span>{L_VISUAL_CONFIRM_POST_EXPLAIN}</span></dt>
|
<dt><label for="enable_post_confirm">{L_VISUAL_CONFIRM_POST}:</label><br /><span>{L_VISUAL_CONFIRM_POST_EXPLAIN}</span></dt>
|
||||||
<dd><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED} <input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</dd>
|
<dd><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED} <input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- IF GD -->
|
<!-- IF GD -->
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_OVERLAP}</legend>
|
|
||||||
<!-- IF TTF -->
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="policy_overlap">{L_CAPTCHA_OVERLAP}:</label><br /><span>{U_POLICY_OVERLAP}</span></dt>
|
<dt><label for="captcha_gd">{L_CAPTCHA_GD}:</label><br /><span>{L_CAPTCHA_GD_EXPLAIN}</span></dt>
|
||||||
<dd><input id="policy_overlap" name="policy_overlap" value="1" class="radio" type="radio"<!-- IF OVERLAP_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_overlap" value="0" class="radio" type="radio"<!-- IF not OVERLAP_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
<dd><input id="captcha_gd" name="captcha_gd" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="captcha_gd" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="policy_overlap_noise_pixel">{L_OVERLAP_NOISE_PIXEL}:</label></dt>
|
<dt><label for="captcha_gd_noise">{L_CAPTCHA_GD_NOISE}:</label><br /><span>{L_CAPTCHA_GD_NOISE_EXPLAIN}</span></dt>
|
||||||
<dd><select id="policy_overlap_noise_pixel" name="policy_overlap_noise_pixel"><option value="0"<!-- IF OVERLAP_NOISE_PIXEL eq '0' --> selected="selected"<!-- ENDIF -->>{L_NO_NOISE}</option><option value="1"<!-- IF OVERLAP_NOISE_PIXEL eq '1' --> selected="selected"<!-- ENDIF -->>{L_LIGHT}</option><option value="2"<!-- IF OVERLAP_NOISE_PIXEL eq '2' --> selected="selected"<!-- ENDIF -->>{L_MEDIUM}</option><option value="3"<!-- IF OVERLAP_NOISE_PIXEL eq '3' --> selected="selected"<!-- ENDIF -->>{L_HEAVY}</option></select></dd>
|
<dd><input id="captcha_gd_noise" name="captcha_gd_noise" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_NOISE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="captcha_gd_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_overlap_noise_line">{L_OVERLAP_NOISE_LINE}:</label></dt>
|
|
||||||
|
|
||||||
<dd><input id="policy_overlap_noise_line" name="policy_overlap_noise_line" value="1" class="radio" type="radio"<!-- IF OVERLAP_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_overlap_noise_line" value="0" class="radio" type="radio"<!-- IF not OVERLAP_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_ENTROPY}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_entropy">{L_CAPTCHA_ENTROPY}:</label><br /><span>{U_POLICY_ENTROPY}</span></dt>
|
|
||||||
<dd><input id="policy_entropy" name="policy_entropy" value="1" class="radio" type="radio"<!-- IF ENTROPY_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_entropy" value="0" class="radio" type="radio"<!-- IF not ENTROPY_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_entropy_noise_pixel">{L_ENTROPY_NOISE_PIXEL}:</label></dt>
|
|
||||||
<dd><select id="policy_entropy_noise_pixel" name="policy_entropy_noise_pixel"><option value="0"<!-- IF ENTROPY_NOISE_PIXEL eq '0' --> selected="selected"<!-- ENDIF -->>{L_NO_NOISE}</option><option value="1"<!-- IF ENTROPY_NOISE_PIXEL eq '1' --> selected="selected"<!-- ENDIF -->>{L_LIGHT}</option><option value="2"<!-- IF ENTROPY_NOISE_PIXEL eq '2' --> selected="selected"<!-- ENDIF -->>{L_MEDIUM}</option><option value="3"<!-- IF ENTROPY_NOISE_PIXEL eq '3' --> selected="selected"<!-- ENDIF -->>{L_HEAVY}</option></select></dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
|
|
||||||
<dt><label for="policy_entropy_noise_line">{L_ENTROPY_NOISE_LINE}:</label></dt>
|
|
||||||
<dd><input id="policy_entropy_noise_line" name="policy_entropy_noise_line" value="1" class="radio" type="radio"<!-- IF ENTROPY_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_entropy_noise_line" value="0" class="radio" type="radio"<!-- IF not ENTROPY_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- IF TTF -->
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_SHAPE}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_shape">{L_CAPTCHA_SHAPE}:</label><br /><span>{U_POLICY_SHAPE}</span></dt>
|
|
||||||
<dd><input id="policy_shape" name="policy_shape" value="1" class="radio" type="radio"<!-- IF SHAPE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_shape" value="0" class="radio" type="radio"<!-- IF not SHAPE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_shape_noise_pixel">{L_SHAPE_NOISE_PIXEL}:</label></dt>
|
|
||||||
<dd><select id="policy_shape_noise_pixel" name="policy_shape_noise_pixel"><option value="0"<!-- IF SHAPE_NOISE_PIXEL eq '0' --> selected="selected"<!-- ENDIF -->>{L_NO_NOISE}</option><option value="1"<!-- IF SHAPE_NOISE_PIXEL eq '1' --> selected="selected"<!-- ENDIF -->>{L_LIGHT}</option><option value="2"<!-- IF SHAPE_NOISE_PIXEL eq '2' --> selected="selected"<!-- ENDIF -->>{L_MEDIUM}</option><option value="3"<!-- IF SHAPE_NOISE_PIXEL eq '3' --> selected="selected"<!-- ENDIF -->>{L_HEAVY}</option></select></dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_shape_noise_line">{L_SHAPE_NOISE_LINE}:</label></dt>
|
|
||||||
<dd><input id="policy_shape_noise_line" name="policy_shape_noise_line" value="1" class="radio" type="radio"<!-- IF SHAPE_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_shape_noise_line" value="0" class="radio" type="radio"<!-- IF not SHAPE_NOISE_LINE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_3DBITMAP}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_3dbitmap">{L_CAPTCHA_3DBITMAP}:</label><br /><span>{U_POLICY_3DBITMAP}</span></dt>
|
|
||||||
<dd><input id="policy_3dbitmap" name="policy_3dbitmap" value="1" class="radio" type="radio"<!-- IF THREEDBITMAP_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_3dbitmap" value="0" class="radio" type="radio"<!-- IF not THREEDBITMAP_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- IF TTF -->
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_CELLS}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_cells">{L_CAPTCHA_CELLS}:</label><br /><span>{U_POLICY_CELLS}</span></dt>
|
|
||||||
<dd><input id="policy_cells" name="policy_cells" value="1" class="radio" type="radio"<!-- IF CELLS_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_cells" value="0" class="radio" type="radio"<!-- IF not CELLS_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_STENCIL}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_stencil">{L_CAPTCHA_STENCIL}:</label><br /><span>{U_POLICY_STENCIL}</span></dt>
|
|
||||||
<dd><input id="policy_stencil" name="policy_stencil" value="1" class="radio" type="radio"<!-- IF STENCIL_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_stencil" value="0" class="radio" type="radio"<!-- IF not STENCIL_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_CAPTCHA_COMPOSITE}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="policy_composite">{L_CAPTCHA_COMPOSITE}:</label><br /><span>{U_POLICY_COMPOSITE}</span></dt>
|
|
||||||
<dd><input id="policy_composite" name="policy_composite" value="1" class="radio" type="radio"<!-- IF COMPOSITE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_YES} <input name="policy_composite" value="0" class="radio" type="radio"<!-- IF not COMPOSITE_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</dd>
|
|
||||||
</dl>
|
|
||||||
</fieldset>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<fieldset class="submit-buttons">
|
<fieldset class="submit-buttons">
|
||||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||||
|
|
|
@ -21,28 +21,13 @@ class acp_captcha
|
||||||
|
|
||||||
$user->add_lang('acp/board');
|
$user->add_lang('acp/board');
|
||||||
|
|
||||||
$config_vars = array('enable_confirm' => 'REG_ENABLE',
|
$config_vars = array(
|
||||||
|
'enable_confirm' => 'REG_ENABLE',
|
||||||
'enable_post_confirm' => 'POST_ENABLE',
|
'enable_post_confirm' => 'POST_ENABLE',
|
||||||
'policy_overlap' => 'OVERLAP_ENABLE',
|
'captcha_gd' => 'CAPTCHA_GD',
|
||||||
'policy_overlap_noise_pixel' => 'OVERLAP_NOISE_PIXEL',
|
'captcha_gd_noise' => 'CAPTCHA_GD_NOISE',
|
||||||
'policy_overlap_noise_line' => 'OVERLAP_NOISE_LINE_ENABLE',
|
|
||||||
'policy_entropy' => 'ENTROPY_ENABLE',
|
|
||||||
'policy_entropy_noise_pixel' => 'ENTROPY_NOISE_PIXEL',
|
|
||||||
'policy_entropy_noise_line' => 'ENTROPY_NOISE_LINE_ENABLE',
|
|
||||||
'policy_shape' => 'SHAPE_ENABLE',
|
|
||||||
'policy_shape_noise_pixel' => 'SHAPE_NOISE_PIXEL',
|
|
||||||
'policy_shape_noise_line' => 'SHAPE_NOISE_LINE_ENABLE',
|
|
||||||
'policy_3dbitmap' => 'THREEDBITMAP_ENABLE',
|
|
||||||
'policy_cells' => 'CELLS_ENABLE',
|
|
||||||
'policy_stencil' => 'STENCIL_ENABLE',
|
|
||||||
'policy_composite' => 'COMPOSITE_ENABLE'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$policy_modules = array('policy_entropy', 'policy_3dbitmap', 'policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite');
|
|
||||||
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'visual':
|
|
||||||
$this->tpl_name = 'acp_captcha';
|
$this->tpl_name = 'acp_captcha';
|
||||||
$this->page_title = 'ACP_VC_SETTINGS';
|
$this->page_title = 'ACP_VC_SETTINGS';
|
||||||
$submit = request_var('submit', '');
|
$submit = request_var('submit', '');
|
||||||
|
@ -59,53 +44,14 @@ class acp_captcha
|
||||||
{
|
{
|
||||||
$array = array();
|
$array = array();
|
||||||
|
|
||||||
foreach ($config_vars as $config_var => $template_var)
|
if (@extension_loaded('gd') && function_exists('imagettfbbox') && function_exists('imagettftext'))
|
||||||
{
|
|
||||||
$array[$template_var] = $config[$config_var];
|
|
||||||
}
|
|
||||||
$template->assign_vars($array);
|
|
||||||
|
|
||||||
|
|
||||||
if (@extension_loaded('gd'))
|
|
||||||
{
|
{
|
||||||
$template->assign_var('GD', true);
|
$template->assign_var('GD', true);
|
||||||
foreach ($policy_modules as $module_name)
|
}
|
||||||
|
foreach ($config_vars as $config_var => $template_var)
|
||||||
{
|
{
|
||||||
$template->assign_var('U_' . strtoupper($module_name), sprintf($user->lang['CAPTCHA_EXPLAIN'], '<a href="' . append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=captcha&mode=img&policy=' . $module_name) . '">', '</a>'));
|
$template->assign_var($template_var, $config[$config_var]);
|
||||||
}
|
}
|
||||||
if (function_exists('imagettfbbox') && function_exists('imagettftext'))
|
|
||||||
{
|
|
||||||
$template->assign_var('TTF', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'img':
|
|
||||||
$policy = request_var('policy', '');
|
|
||||||
|
|
||||||
if (!@extension_loaded('gd'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_GD'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!($policy === 'policy_entropy' || $policy === 'policy_3dbitmap') && (!function_exists('imagettfbbox') || !function_exists('imagettftext')))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_TTF'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($policy, $policy_modules))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['BAD_POLICY'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->add_lang('ucp');
|
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
|
|
||||||
|
|
||||||
$captcha = new captcha();
|
|
||||||
$captcha->execute(gen_rand_string(), $policy);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -612,6 +612,14 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('htmlspecialchars_decode'))
|
||||||
|
{
|
||||||
|
function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT)
|
||||||
|
{
|
||||||
|
return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// functions used for building option fields
|
// functions used for building option fields
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2430,7 +2430,7 @@ function get_database_size()
|
||||||
{
|
{
|
||||||
if ($table_prefix != '')
|
if ($table_prefix != '')
|
||||||
{
|
{
|
||||||
if (strstr($row['Name'], $table_prefix))
|
if (strpos($row['Name'], $table_prefix) !== false)
|
||||||
{
|
{
|
||||||
$database_size += $row['Data_length'] + $row['Index_length'];
|
$database_size += $row['Data_length'] + $row['Index_length'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,17 +478,17 @@ class compress_tar extends compress
|
||||||
// Run through the file and grab directory entries
|
// Run through the file and grab directory entries
|
||||||
while ($buffer = $fzread($this->fp, 512))
|
while ($buffer = $fzread($this->fp, 512))
|
||||||
{
|
{
|
||||||
$tmp = unpack("A6magic", substr($buffer, 257, 6));
|
$tmp = unpack('A6magic', substr($buffer, 257, 6));
|
||||||
|
|
||||||
if (trim($tmp['magic']) == 'ustar')
|
if (trim($tmp['magic']) == 'ustar')
|
||||||
{
|
{
|
||||||
$tmp = unpack("A100name", $buffer);
|
$tmp = unpack('A100name', $buffer);
|
||||||
$filename = trim($tmp['name']);
|
$filename = trim($tmp['name']);
|
||||||
|
|
||||||
$tmp = unpack("Atype", substr($buffer, 156, 1));
|
$tmp = unpack('Atype', substr($buffer, 156, 1));
|
||||||
$filetype = (int) trim($tmp['type']);
|
$filetype = (int) trim($tmp['type']);
|
||||||
|
|
||||||
$tmp = unpack("A12size", substr($buffer, 124, 12));
|
$tmp = unpack('A12size', substr($buffer, 124, 12));
|
||||||
$filesize = octdec((int) trim($tmp['size']));
|
$filesize = octdec((int) trim($tmp['size']));
|
||||||
|
|
||||||
if ($filetype == 5)
|
if ($filetype == 5)
|
||||||
|
@ -508,7 +508,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
@chmod("$str", 0777);
|
@chmod($str, 0777);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ class compress_tar extends compress
|
||||||
@chmod("$dst$filename", 0777);
|
@chmod("$dst$filename", 0777);
|
||||||
|
|
||||||
// Grab the file contents
|
// Grab the file contents
|
||||||
fwrite($fp, $fzread($this->fp, $filesize + 512 - $filesize % 512), $filesize);
|
fwrite($fp, $fzread($this->fp, ($filesize + 511) &~ 511), $filesize);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ class compress_tar extends compress
|
||||||
$fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite');
|
$fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite');
|
||||||
|
|
||||||
// Symbolizes that there are no more files
|
// Symbolizes that there are no more files
|
||||||
$fzwrite($this->fp, pack("a512", ""));
|
$fzwrite($this->fp, str_repeat("\0", 512));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fzclose($this->fp);
|
$fzclose($this->fp);
|
||||||
|
@ -560,37 +560,37 @@ class compress_tar extends compress
|
||||||
|
|
||||||
// This is the header data, it contains all the info we know about the file or folder that we are about to archive
|
// This is the header data, it contains all the info we know about the file or folder that we are about to archive
|
||||||
$header = '';
|
$header = '';
|
||||||
$header .= pack("a100", $name); // file name
|
$header .= pack('a100', $name); // file name
|
||||||
$header .= pack("a8", sprintf("%07o", $stat[2])); // file mode
|
$header .= pack('a8', sprintf("%07o", $stat[2])); // file mode
|
||||||
$header .= pack("a8", sprintf("%07o", $stat[4])); // owner id
|
$header .= pack('a8', sprintf("%07o", $stat[4])); // owner id
|
||||||
$header .= pack("a8", sprintf("%07o", $stat[5])); // group id
|
$header .= pack('a8', sprintf("%07o", $stat[5])); // group id
|
||||||
$header .= pack("a12", sprintf("%011o", $stat[7])); // file size
|
$header .= pack('a12', sprintf("%011o", $stat[7])); // file size
|
||||||
$header .= pack("a12", sprintf("%011o", $stat[9])); // last mod time
|
$header .= pack('a12', sprintf("%011o", $stat[9])); // last mod time
|
||||||
|
|
||||||
// Checksum
|
// Checksum
|
||||||
$checksum = 0;
|
$checksum = 0;
|
||||||
for ($i = 0; $i < 148; $i++)
|
for ($i = 0; $i < 148; $i++)
|
||||||
{
|
{
|
||||||
$checksum += ord(substr($header, $i, 1));
|
$checksum += ord($header[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We precompute the rest of the hash, this saves us time in the loop and allows us to insert our hash without resorting to string functions
|
// We precompute the rest of the hash, this saves us time in the loop and allows us to insert our hash without resorting to string functions
|
||||||
$checksum += 2415 + (($is_dir) ? 53 : 0);
|
$checksum += 2415 + (($is_dir) ? 53 : 0);
|
||||||
|
|
||||||
$header .= pack("a8", sprintf("%07o", $checksum)); // checksum
|
$header .= pack('a8', sprintf("%07o", $checksum)); // checksum
|
||||||
$header .= pack("a1", $typeflag); // link indicator
|
$header .= pack('a1', $typeflag); // link indicator
|
||||||
$header .= pack("a100", ''); // name of linked file
|
$header .= pack('a100', ''); // name of linked file
|
||||||
$header .= pack("a6", 'ustar'); // ustar indicator
|
$header .= pack('a6', 'ustar'); // ustar indicator
|
||||||
$header .= pack("a2", '00'); // ustar version
|
$header .= pack('a2', '00'); // ustar version
|
||||||
$header .= pack("a32", 'Unknown'); // owner name
|
$header .= pack('a32', 'Unknown'); // owner name
|
||||||
$header .= pack("a32", 'Unknown'); // group name
|
$header .= pack('a32', 'Unknown'); // group name
|
||||||
$header .= pack("a8", ''); // device major number
|
$header .= pack('a8', ''); // device major number
|
||||||
$header .= pack("a8", ''); // device minor number
|
$header .= pack('a8', ''); // device minor number
|
||||||
$header .= pack("a155", ''); // filename prefix
|
$header .= pack('a155', ''); // filename prefix
|
||||||
$header .= pack("a12", ''); // end
|
$header .= pack('a12', ''); // end
|
||||||
|
|
||||||
// This writes the entire file in one shot. Header, followed by data and then null padded to a multiple of 512
|
// This writes the entire file in one shot. Header, followed by data and then null padded to a multiple of 512
|
||||||
$fzwrite($this->fp, $header . (($stat[7] !== 0 && !$is_dir) ? $data . (($stat[7] % 512 > 0) ? str_repeat("\0", 512 - $stat[7] % 512) : '') : ''));
|
$fzwrite($this->fp, $header . (($stat[7] !== 0 && !$is_dir) ? $data . str_repeat("\0", (($stat[7] + 511) &~ 511) - $stat[7]) : ''));
|
||||||
unset($data);
|
unset($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,46 +54,9 @@ class ucp_confirm
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some people might want the olde style CAPTCHA even if they have GD enabled, this also saves us from people who have GD but no TTF
|
if ($config['captcha_gd'])
|
||||||
$policy_modules = array('policy_entropy', 'policy_3dbitmap');
|
|
||||||
|
|
||||||
if (function_exists('imagettfbbox') && function_exists('imagettftext'))
|
|
||||||
{
|
{
|
||||||
$policy_modules = array_merge($policy_modules, array('policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite'));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($policy_modules as $key => $name)
|
|
||||||
{
|
|
||||||
if ($config[$name] === '0')
|
|
||||||
{
|
|
||||||
unset($policy_modules[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$policy = '';
|
|
||||||
if (@extension_loaded('gd') && sizeof($policy_modules))
|
|
||||||
{
|
|
||||||
$change_lang = request_var('change_lang', '');
|
|
||||||
|
|
||||||
if ($change_lang)
|
|
||||||
{
|
|
||||||
$change_lang = basename($change_lang);
|
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'language/' . $change_lang . '/'))
|
|
||||||
{
|
|
||||||
$user->lang_name = $lang = $change_lang;
|
|
||||||
$user->lang_path = $phpbb_root_path . 'language/' . $lang . '/';
|
|
||||||
$user->lang = array();
|
|
||||||
$user->add_lang(array('common', 'ucp'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$change_lang = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
|
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
|
||||||
$policy = $policy_modules[array_rand($policy_modules)];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -101,7 +64,7 @@ class ucp_confirm
|
||||||
}
|
}
|
||||||
|
|
||||||
$captcha = new captcha();
|
$captcha = new captcha();
|
||||||
$captcha->execute($row['code'], $policy);
|
$captcha->execute($row['code']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,96 +27,6 @@ define('UTF8_CJK_LAST', "\xE9\xBE\xBB");
|
||||||
define('UTF8_CJK_B_FIRST', "\xF0\xA0\x80\x80");
|
define('UTF8_CJK_B_FIRST', "\xF0\xA0\x80\x80");
|
||||||
define('UTF8_CJK_B_LAST', "\xF0\xAA\x9B\x96");
|
define('UTF8_CJK_B_LAST', "\xF0\xAA\x9B\x96");
|
||||||
|
|
||||||
|
|
||||||
// Wrapper for the utfnormal extension, ICU wrapper
|
|
||||||
if (function_exists('utf8_normalize'))
|
|
||||||
{
|
|
||||||
define('UNORM_NONE', 1);
|
|
||||||
define('UNORM_NFD', 2);
|
|
||||||
define('UNORM_NFKD', 3);
|
|
||||||
define('UNORM_NFC', 4);
|
|
||||||
define('UNORM_NFKC', 5);
|
|
||||||
define('UNORM_FCD', 6);
|
|
||||||
define('UNORM_DEFAULT', UNORM_NFC);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* utf_normalizer class for the utfnormal extension
|
|
||||||
*
|
|
||||||
* @ignore
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class utf_normalizer
|
|
||||||
{
|
|
||||||
function cleanup($str)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The string below is the list of all autorized characters, sorted by
|
|
||||||
* frequency in latin text
|
|
||||||
*/
|
|
||||||
$pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D");
|
|
||||||
|
|
||||||
if (!isset($str[$pos]))
|
|
||||||
{
|
|
||||||
// ASCII strings with no special chars return immediately
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there is potentially a U+FFFE or U+FFFF char (UTF sequence 0xEFBFBE or 0xEFBFBF) and replace them
|
|
||||||
// Note: we start searching at position $pos
|
|
||||||
if (is_int(strpos($str, "\xEF\xBF", $pos)))
|
|
||||||
{
|
|
||||||
$str = str_replace(
|
|
||||||
array("\xEF\xBF\xBE", "\xEF\xBF\xBF"),
|
|
||||||
array(UTF8_REPLACEMENT, UTF8_REPLACEMENT),
|
|
||||||
$str
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace any byte in the range 0x00..0x1F, except for \r, \n and \t
|
|
||||||
// We replace those characters with a 0xFF byte, which is illegal in
|
|
||||||
// UTF-8 and will in turn be replaced with a Unicode replacement char
|
|
||||||
$str = strtr(
|
|
||||||
$str,
|
|
||||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
|
|
||||||
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
|
|
||||||
);
|
|
||||||
|
|
||||||
// As per the original implementation, "the UnicodeString constructor fails if the string ends with a head byte".
|
|
||||||
// Therefore, if the string ends with a leading byte we replace it with 0xFF, which is illegal too and will be
|
|
||||||
// replaced with a Unicode replacement character
|
|
||||||
if (substr($str, -1) >= "\xC0")
|
|
||||||
{
|
|
||||||
$str[strlen($str) - 1] = "\xFF";
|
|
||||||
}
|
|
||||||
|
|
||||||
return utf8_normalize($str, UNORM_NFC);
|
|
||||||
}
|
|
||||||
|
|
||||||
function nfc($str)
|
|
||||||
{
|
|
||||||
return utf8_normalize($str, UNORM_NFC);
|
|
||||||
}
|
|
||||||
|
|
||||||
function nfkc($str)
|
|
||||||
{
|
|
||||||
return utf8_normalize($str, UNORM_NFKC);
|
|
||||||
}
|
|
||||||
|
|
||||||
function nfd($str)
|
|
||||||
{
|
|
||||||
return utf8_normalize($str, UNORM_NFD);
|
|
||||||
}
|
|
||||||
|
|
||||||
function nfkd($str)
|
|
||||||
{
|
|
||||||
return utf8_normalize($str, UNORM_NFKD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This block will NOT be loaded if the utfnormal extension is
|
|
||||||
|
|
||||||
// Unset global variables
|
// Unset global variables
|
||||||
unset($GLOBALS['utf_jamo_index'], $GLOBALS['utf_jamo_type'], $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_combining_class'], $GLOBALS['utf_canonical_comp'], $GLOBALS['utf_canonical_decomp'], $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']);
|
unset($GLOBALS['utf_jamo_index'], $GLOBALS['utf_jamo_type'], $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_combining_class'], $GLOBALS['utf_canonical_comp'], $GLOBALS['utf_canonical_decomp'], $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']);
|
||||||
|
|
||||||
|
@ -1589,6 +1499,5 @@ else
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -781,7 +781,7 @@ function utf8_recode($string, $encoding)
|
||||||
*/
|
*/
|
||||||
function utf8_encode_ncr($text)
|
function utf8_encode_ncr($text)
|
||||||
{
|
{
|
||||||
return preg_replace_callback('#[\\xC2-\\xF4][\\x80-\\xBF]?[\\x80-\\xBF]?[\\x80-\\xBF]+#', 'utf8_encode_ncr_callback', $text);
|
return preg_replace_callback('#[\\xC2-\\xF4][\\x80-\\xBF]{1,3}#', 'utf8_encode_ncr_callback', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -824,7 +824,7 @@ function utf8_ord($chr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return $m;
|
return $chr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1185,12 +1185,12 @@ class install_install extends module
|
||||||
SET forum_last_post_time = $current_time",
|
SET forum_last_post_time = $current_time",
|
||||||
);
|
);
|
||||||
|
|
||||||
// This is for people who have TTF disabled
|
// This is for people who have TTF and GD
|
||||||
if (!(@function_exists('imagettfbbox') && @function_exists('imagettftext')))
|
if (@extension_loaded('gd') && function_exists('imagettfbbox') && function_exists('imagettftext'))
|
||||||
{
|
{
|
||||||
$sql_ary[] = 'UPDATE ' . $table_prefix . "config
|
$sql_ary[] = 'UPDATE ' . $table_prefix . "config
|
||||||
SET config_value = '0'
|
SET config_value = '1'
|
||||||
WHERE config_name = 'policy_shape'";
|
WHERE config_name = 'captcha_gd'";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($sql_ary as $sql)
|
foreach ($sql_ary as $sql)
|
||||||
|
@ -1732,11 +1732,17 @@ class install_install extends module
|
||||||
{
|
{
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'mysqli':
|
case 'mysqli':
|
||||||
case 'sqlite':
|
|
||||||
$sql = 'SHOW TABLES';
|
$sql = 'SHOW TABLES';
|
||||||
$field = "Tables_in_{$dbname}";
|
$field = "Tables_in_{$dbname}";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'sqlite':
|
||||||
|
$sql = 'SELECT name
|
||||||
|
FROM sqlite_master
|
||||||
|
WHERE type = "table"';
|
||||||
|
$field = 'name';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
case 'mssql_odbc':
|
case 'mssql_odbc':
|
||||||
$sql = "SELECT name
|
$sql = "SELECT name
|
||||||
|
|
|
@ -163,19 +163,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', '.*
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_overlap', '0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_overlap_noise_pixel', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_noise', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_overlap_noise_line', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_pixel', '2');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_entropy_noise_line', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_shape', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_shape_noise_pixel', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_shape_noise_line', '1');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_3dbitmap', '0');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_cells', '0');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_stencil', '0');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('policy_composite', '0');
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600');
|
||||||
|
|
|
@ -213,28 +213,10 @@ $lang = array_merge($lang, array(
|
||||||
$lang = array_merge($lang, array(
|
$lang = array_merge($lang, array(
|
||||||
'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and captcha settings.',
|
'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and captcha settings.',
|
||||||
|
|
||||||
'BAD_POLICY' => 'The policy you selected is invalid.',
|
'CAPTCHA_GD' => 'GD CAPTCHA',
|
||||||
'CAPTCHA_3DBITMAP' => '3D Bitmap',
|
'CAPTCHA_GD_NOISE' => 'GD CAPTCHA Noise',
|
||||||
'CAPTCHA_CELLS' => 'Cells',
|
'CAPTCHA_GD_EXPLAIN' => 'Use GD to make a more advanced CAPTCHA',
|
||||||
'CAPTCHA_COMPOSITE' => 'Composite',
|
'CAPTCHA_GD_NOISE_EXPLAIN' => 'Use noise to make the GD based CAPTCHA harder',
|
||||||
'CAPTCHA_ENTROPY' => 'Entropy',
|
|
||||||
'CAPTCHA_OPTIONS' => 'Captcha options',
|
|
||||||
'CAPTCHA_OVERLAP' => 'Overlap',
|
|
||||||
'CAPTCHA_SHAPE' => 'Shape',
|
|
||||||
'CAPTCHA_STENCIL' => 'Stencil',
|
|
||||||
'CAPTCHA_EXPLAIN' => '%sPreview this CAPTCHA policy%s.',
|
|
||||||
'ENTROPY_NOISE_LINE' => 'Entropy line noise',
|
|
||||||
'ENTROPY_NOISE_PIXEL' => 'Entropy pixel noise',
|
|
||||||
'HEAVY' => 'Heavy',
|
|
||||||
'LIGHT' => 'Light',
|
|
||||||
'MEDIUM' => 'Medium',
|
|
||||||
'NO_GD' => 'The server does not support GD, an extension required to enable the advanced CAPTCHA policies. A fall-back method will be used if you decide to enable visual confirmation features.',
|
|
||||||
'NO_NOISE' => 'None',
|
|
||||||
'NO_TTF' => 'The policy you selected requires TTF enabled, the server has TTF disabled. If this policy is enabled, it will be skipped and another policy will be used in its place. If no valid policies are enabled, a fall-back method will be used if you decide to enable Visual Confirmation features.',
|
|
||||||
'OVERLAP_NOISE_LINE' => 'Overlap line noise',
|
|
||||||
'OVERLAP_NOISE_PIXEL' => 'Overlap pixel noise',
|
|
||||||
'SHAPE_NOISE_LINE' => 'Shape line noise',
|
|
||||||
'SHAPE_NOISE_PIXEL' => 'Shape pixel noise',
|
|
||||||
'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings',
|
'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_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' => 'Enable visual confirmation for registrations',
|
||||||
|
|
Loading…
Add table
Reference in a new issue