request_var updates

attachment updates/fixes


git-svn-id: file:///svn/phpbb/trunk@4540 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-10-09 14:49:21 +00:00
parent 4da761be39
commit 40c38c6f81
2 changed files with 13 additions and 12 deletions

View file

@ -171,7 +171,7 @@ function update_last_post_information($type, $id, &$parent_sql)
$update_sql[] = 'forum_last_poster_id = 0'; $update_sql[] = 'forum_last_poster_id = 0';
$update_sql[] = "forum_last_poster_name = ''"; $update_sql[] = "forum_last_poster_name = ''";
} }
/*
// Return 'Udate all Parents' information // Return 'Udate all Parents' information
// Not able to test this, since subforums seems to be broken // Not able to test this, since subforums seems to be broken
if ($type == 'forum') if ($type == 'forum')
@ -190,6 +190,7 @@ function update_last_post_information($type, $id, &$parent_sql)
WHERE forum_id IN (' . implode(', ', $forum_ids) . ')'; WHERE forum_id IN (' . implode(', ', $forum_ids) . ')';
} }
} }
*/
return $update_sql; return $update_sql;
} }

View file

@ -678,19 +678,19 @@ class parse_message
function parse_attachments($mode, $post_id, $submit, $preview, $refresh) function parse_attachments($mode, $post_id, $submit, $preview, $refresh)
{ {
global $config, $_FILE, $_POST, $auth, $user; global $config, $_FILES, $_POST, $auth, $user;
$error = array(); $error = array();
$num_attachments = count($this->attachment_data); $num_attachments = count($this->attachment_data);
$this->filename_data['filecomment'] = (isset($_POST['filecomment'])) ? htmlspecialchars(trim(str_replace(array('\\\'', '\\"', '\\0', '\\\\'), array('\'', '"', '\0', '\\'), $_POST['filecomment']))) : ''; $this->filename_data['filecomment'] = request_var('filecomment', '');
$this->filename_data['filename'] = ($_FILES['fileupload']['name'] != 'none') ? trim($_FILES['fileupload']['name']) : ''; $this->filename_data['filename'] = ($_FILES['fileupload']['name'] != 'none') ? trim($_FILES['fileupload']['name']) : '';
$add_file = (isset($_POST['add_file'])) ? TRUE : FALSE; $add_file = (isset($_POST['add_file'])) ? TRUE : FALSE;
$delete_file = (isset($_POST['delete_file'])) ? TRUE : FALSE; $delete_file = (isset($_POST['delete_file'])) ? TRUE : FALSE;
$edit_comment = (isset($_POST['edit_comment'])) ? TRUE : FALSE; $edit_comment = (isset($_POST['edit_comment'])) ? TRUE : FALSE;
if ($submit && ($mode == 'post' || $mode == 'reply' || $mode == 'edit') && $this->filename_data['filename'] != '') if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $this->filename_data['filename'] != '')
{ {
if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_')) if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
{ {
@ -708,7 +708,7 @@ class parse_message
'mimetype' => $filedata['mimetype'], 'mimetype' => $filedata['mimetype'],
'filesize' => $filedata['filesize'], 'filesize' => $filedata['filesize'],
'filetime' => $filedata['filetime'], 'filetime' => $filedata['filetime'],
'attach_id' => '-1', 'attach_id' => 0,
'thumbnail' => $filedata['thumbnail'] 'thumbnail' => $filedata['thumbnail']
); );
@ -716,9 +716,9 @@ class parse_message
$this->filename_data['filecomment'] = ''; $this->filename_data['filecomment'] = '';
// This Variable is set to FALSE here, because Attachments are entered into the // This Variable is set to FALSE here, because Attachments are entered into the
// Database in two modes, one if the id_list is -1 and the second one if post_attach is true // Database in two modes, one if the id_list is 0 and the second one if post_attach is true
// Since post_attach is automatically switched to true if an Attachment got added to the filesystem, // Since post_attach is automatically switched to true if an Attachment got added to the filesystem,
// but we are assigning an id of -1 here, we have to reset the post_attach variable to false. // but we are assigning an id of 0 here, we have to reset the post_attach variable to false.
// //
// This is very relevant, because it could happen that the post got not submitted, but we do not // This is very relevant, because it could happen that the post got not submitted, but we do not
// know this circumstance here. We could be at the posting page or we could be redirected to the entered // know this circumstance here. We could be at the posting page or we could be redirected to the entered
@ -740,7 +740,7 @@ class parse_message
$index = (int) key($_POST['delete_file']); $index = (int) key($_POST['delete_file']);
// delete selected attachment // delete selected attachment
if ($this->attachment_data[$index]['attach_id'] == '-1') if (!$this->attachment_data[$index]['attach_id'])
{ {
phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'file'); phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'file');
@ -769,11 +769,11 @@ class parse_message
{ {
if ($edit_comment) if ($edit_comment)
{ {
$actual_comment_list = (isset($_POST['comment_list'])) ? $_POST['comment_list'] : ''; $actual_comment_list = request_var('comment_list', '');
foreach ($actual_comment_list as $index => $entry) foreach ($actual_comment_list as $index => $entry)
{ {
$this->attachment_data[$index]['comment'] = htmlspecialchars(trim(str_replace(array('\\\'', '\\"', '\\0', '\\\\'), array('\'', '"', '\0', '\\'), $entry))); $this->attachment_data[$index]['comment'] = $entry;
} }
} }
@ -795,7 +795,7 @@ class parse_message
'mimetype' => $filedata['mimetype'], 'mimetype' => $filedata['mimetype'],
'filesize' => $filedata['filesize'], 'filesize' => $filedata['filesize'],
'filetime' => $filedata['filetime'], 'filetime' => $filedata['filetime'],
'attach_id' => '-1', 'attach_id' => 0,
'thumbnail' => $filedata['thumbnail'] 'thumbnail' => $filedata['thumbnail']
); );