Attachment system bugfix (#141)

This commit is contained in:
Roman Kelesidis 2023-04-08 13:28:25 +07:00 committed by GitHub
parent 35ddccfc12
commit f1c8246ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View File

@ -29,12 +29,8 @@ switch ($ajax->action)
case 'view_torrent':
case 'mod_action':
case 'change_tor_status':
case 'gen_passkey':
require(ATTACH_DIR . 'attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
break;
case 'change_torrent':
case 'gen_passkey':
require(ATTACH_DIR . 'attachment_mod.php');
require(INC_DIR . 'functions_torrent.php');
break;

View File

@ -547,9 +547,11 @@ function get_var($var_name, $default, $multibyte = false)
}
else
{
list($key_type, $type) = each($default);
$type = gettype($type);
$key_type = gettype($key_type);
foreach ($default as $key_type => $type)
{
$key_type = gettype($key_type);
$type = gettype($type);
}
}
if (is_array($var))

View File

@ -975,7 +975,7 @@ class attach_parent
$this->attach_filename = preg_replace('#([\xC2\xC3])([\x80-\xBF])#', 'chr(ord(\'$1\')<<6&0xC0|ord(\'$2\')&0x3F)', $this->attach_filename);
$this->attach_filename = rawurlencode($this->attach_filename);
$this->attach_filename = preg_replace("/(%[0-9A-F]{1,2})/i", '', $this->attach_filename);
$this->attach_filename = trim($this->attach_filename);
$this->attach_filename = trim($this->attach_filename . time());
}
$this->attach_filename = str_replace(array('&amp;','&',' '), '_', $this->attach_filename);
$this->attach_filename = str_replace('php', '_php_', $this->attach_filename);

View File

@ -121,6 +121,7 @@ if (!$t_data = DB()->fetch_row($sql))
$forum_topic_data =& $t_data;
$topic_id = $t_data['topic_id'];
$forum_id = $t_data['forum_id'];
$topic_attachment = isset($t_data['topic_attachment']) ? (int)$t_data['topic_attachment'] : null;
if($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_porn_forums')) bb_die($lang['ERROR_PORNO_FORUM']);
@ -131,7 +132,7 @@ if ($userdata['session_admin'] && !empty($_REQUEST['mod']))
$datastore->enqueue(array('viewtopic_forum_select'));
}
}
if ($t_data['topic_attachment'])
if ($topic_attachment)
{
$datastore->enqueue(array(
'attach_extensions',
@ -606,7 +607,7 @@ $template->assign_vars(array(
));
require(INC_DIR .'torrent_show_dl_list.php');
if ($t_data['topic_attachment'])
if ($topic_attachment)
{
require(ATTACH_DIR .'attachment_mod.php');
init_display_post_attachments($t_data['topic_attachment']);