From: Joas S. <nic...@ph...> - 2009-09-25 08:42:30
|
Author: nickvergessen Date: Fri Sep 25 09:41:47 2009 New Revision: 10186 Log: Fix Bug #51835 - editing posts with attachments - regression from r9843 introduced in #48265 Authorised by: AcydBurn Modified: branches/phpBB-3_0_0/phpBB/includes/message_parser.php branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_compose.php branches/phpBB-3_0_0/phpBB/posting.php Modified: branches/phpBB-3_0_0/phpBB/includes/message_parser.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/message_parser.php (original) --- branches/phpBB-3_0_0/phpBB/includes/message_parser.php Fri Sep 25 09:41:47 2009 *************** *** 1345,1351 **** /** * Parse Attachments */ ! function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false, $post_msg_id = 0, $topic_id = 0) { global $config, $auth, $user, $phpbb_root_path, $phpEx, $db; --- 1345,1351 ---- /** * Parse Attachments */ ! function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { global $config, $auth, $user, $phpbb_root_path, $phpEx, $db; *************** *** 1498,1524 **** 'filesize' => $filedata['filesize'], 'filetime' => $filedata['filetime'], 'thumbnail' => $filedata['thumbnail'], ! 'is_orphan' => ($post_msg_id) ? 0 : 1, 'in_message' => ($is_message) ? 1 : 0, 'poster_id' => $user->data['user_id'], ); - if ($post_msg_id) - { - $sql_ary['post_msg_id'] = $post_msg_id; - if ($topic_id) - { - $sql_ary['topic_id'] = $topic_id; - } - set_config_count('upload_dir_size', $filedata['filesize'], true); - set_config_count('num_files', 1, true); - } - $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_entry = array( 'attach_id' => $db->sql_nextid(), ! 'is_orphan' => ($post_msg_id) ? 0 : 1, 'real_filename' => $filedata['real_filename'], 'attach_comment'=> $this->filename_data['filecomment'], ); --- 1498,1513 ---- 'filesize' => $filedata['filesize'], 'filetime' => $filedata['filetime'], 'thumbnail' => $filedata['thumbnail'], ! 'is_orphan' => 1, 'in_message' => ($is_message) ? 1 : 0, 'poster_id' => $user->data['user_id'], ); $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_entry = array( 'attach_id' => $db->sql_nextid(), ! 'is_orphan' => 1, 'real_filename' => $filedata['real_filename'], 'attach_comment'=> $this->filename_data['filecomment'], ); Modified: branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_compose.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_compose.php (original) --- branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_compose.php Fri Sep 25 09:41:47 2009 *************** *** 669,690 **** } // Parse Attachments - before checksum is calculated ! if ($action == 'edit') ! { ! $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true, $msg_id); ! if (sizeof($message_parser->attachment_data)) ! { ! // Update attachment indicators for pms having attachments now, as a precaution if the pm does not get stored by submit ! $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' ! SET message_attachment = 1 ! WHERE msg_id = ' . $msg_id; ! $db->sql_query($sql); ! } ! } ! else ! { ! $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); ! } if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) { --- 669,675 ---- } // Parse Attachments - before checksum is calculated ! $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) { Modified: branches/phpBB-3_0_0/phpBB/posting.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/posting.php (original) --- branches/phpBB-3_0_0/phpBB/posting.php Fri Sep 25 09:41:47 2009 *************** *** 742,769 **** } // Parse Attachments - before checksum is calculated ! if ($mode == 'edit') ! { ! $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh, false, $post_id, $topic_id); ! if (sizeof($message_parser->attachment_data)) ! { ! // Update attachment indicators for post/topic having attachments now, as a precaution if the post does not get stored by submit ! $sql = 'UPDATE ' . POSTS_TABLE . ' ! SET post_attachment = 1 ! WHERE post_id = ' . $post_id; ! $db->sql_query($sql); ! ! $sql = 'UPDATE ' . TOPICS_TABLE . ' ! SET topic_attachment = 1 ! WHERE topic_id = ' . $topic_id; ! $db->sql_query($sql); ! } ! } ! else ! { ! $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); ! } ! // Grab md5 'checksum' of new message $message_md5 = md5($message_parser->message); --- 742,748 ---- } // Parse Attachments - before checksum is calculated ! $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); // Grab md5 'checksum' of new message $message_md5 = md5($message_parser->message); |