mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 16:27:38 +02:00
- check for array [lang]
- admin_forums delete routine updated - added extension groups per forum git-svn-id: file:///svn/phpbb/trunk@4861 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -883,11 +883,13 @@ function obtain_attach_extensions(&$extensions)
|
||||
{
|
||||
$extension = strtolower(trim($row['extension']));
|
||||
|
||||
$extensions['_allowed_'][] = $extension;
|
||||
$extensions[$extension]['display_cat'] = (int) $row['cat_id'];
|
||||
$extensions[$extension]['download_mode'] = (int) $row['download_mode'];
|
||||
$extensions[$extension]['upload_icon'] = trim($row['upload_icon']);
|
||||
$extensions[$extension]['max_filesize'] = (int) $row['max_filesize'];
|
||||
|
||||
// Store allowed extensions forum wise
|
||||
$extensions['_allowed_'][$extension] = (!$row['allowed_forums']) ? 0 : unserialize(trim($row['allowed_forums']));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
@@ -331,7 +331,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
}
|
||||
|
||||
// Display Attachments
|
||||
function display_attachments($blockname, $attachment_data, &$update_count, $force_physical = false, $return = false)
|
||||
function display_attachments($forum_id, $blockname, $attachment_data, &$update_count, $force_physical = false, $return = false)
|
||||
{
|
||||
global $extensions, $template, $cache, $attachment_tpl;
|
||||
global $config, $user, $phpbb_root_path, $phpEx, $SID;
|
||||
@@ -409,11 +409,11 @@ function display_attachments($blockname, $attachment_data, &$update_count, $forc
|
||||
$display_name = $attachment['real_filename'];
|
||||
$comment = str_replace("\n", '<br />', censor_text($attachment['comment']));
|
||||
|
||||
$denied = FALSE;
|
||||
$denied = false;
|
||||
|
||||
if (!in_array($attachment['extension'], $extensions['_allowed_']))
|
||||
if ((is_array($extensions['_allowed_'][$attachment['extension']]) && !in_array($forum_id, $extensions['_allowed_'][$attachment['extension']])) || !isset($extensions['_allowed_'][$attachment['extension']]))
|
||||
{
|
||||
$denied = TRUE;
|
||||
$denied = true;
|
||||
|
||||
$template_array['VAR'] = array('{L_DENIED}');
|
||||
$template_array['VAL'] = array(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']));
|
||||
@@ -423,9 +423,16 @@ function display_attachments($blockname, $attachment_data, &$update_count, $forc
|
||||
// Replace {L_*} lang strings
|
||||
$tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl);
|
||||
|
||||
$template->assign_block_vars($blockname, array(
|
||||
'SHOW_ATTACHMENT' => $tpl)
|
||||
);
|
||||
if (!$return)
|
||||
{
|
||||
$template->assign_block_vars($blockname, array(
|
||||
'DISPLAY_ATTACHMENT' => $tpl)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$return_tpl[] = $tpl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$denied)
|
||||
|
@@ -162,7 +162,7 @@ function update_last_post_information($type, $id)
|
||||
}
|
||||
|
||||
// Upload Attachment - filedata is generated here
|
||||
function upload_attachment($filename, $local = false, $local_storage = '')
|
||||
function upload_attachment($forum_id, $filename, $local = false, $local_storage = '')
|
||||
{
|
||||
global $auth, $user, $config, $db;
|
||||
|
||||
@@ -188,7 +188,7 @@ function upload_attachment($filename, $local = false, $local_storage = '')
|
||||
obtain_attach_extensions($extensions);
|
||||
|
||||
// Check Extension
|
||||
if (!in_array($filedata['extension'], $extensions['_allowed_']))
|
||||
if ((is_array($extensions['_allowed_'][$filedata['extension']]) && !in_array($forum_id, $extensions['_allowed_'][$filedata['extension']])) || !isset($extensions['_allowed_'][$filedata['extension']]))
|
||||
{
|
||||
$filedata['error'][] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']);
|
||||
$filedata['post_attach'] = false;
|
||||
|
@@ -706,7 +706,7 @@ class parse_message
|
||||
// Parse Attachments
|
||||
function parse_attachments($mode, $post_id, $submit, $preview, $refresh)
|
||||
{
|
||||
global $config, $auth, $user;
|
||||
global $config, $auth, $user, $forum_id;
|
||||
global $_FILES, $_POST;
|
||||
|
||||
$error = array();
|
||||
@@ -723,7 +723,7 @@ class parse_message
|
||||
{
|
||||
if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
{
|
||||
$filedata = upload_attachment($this->filename_data['filename']);
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename']);
|
||||
|
||||
$error = $filedata['error'];
|
||||
|
||||
@@ -807,7 +807,7 @@ class parse_message
|
||||
{
|
||||
if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
|
||||
{
|
||||
$filedata = upload_attachment($this->filename_data['filename']);
|
||||
$filedata = upload_attachment($forum_id, $this->filename_data['filename']);
|
||||
|
||||
$error = array_merge($error, $filedata['error']);
|
||||
|
||||
|
Reference in New Issue
Block a user