1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 06:51:33 +02:00

[feature/attach-dl] Moved filename cleaning into own function

PHPBB3-11042
This commit is contained in:
Fyorl
2012-08-14 11:42:23 +01:00
parent e8830c3369
commit 20ecd046da
2 changed files with 22 additions and 8 deletions

View File

@@ -374,14 +374,7 @@ else
trigger_error('ERROR_NO_ATTACHMENT');
}
$bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|');
$clean_name = current($row);
// rawurlencode to convert any potentially 'bad' characters that we missed
$clean_name = rawurlencode(str_replace($bad_chars, '_', $clean_name));
// Turn the %xx entities created by rawurlencode to _
$clean_name = preg_replace("/%(\w{2})/", '_', $clean_name);
$clean_name = phpbb_download_clean_filename(current($row));
$suffix = '_' . (($post_id) ? $post_id : $topic_id) . '_' . $clean_name;
$store_name = 'att_' . time() . '_' . unique_id();