Changeset 702 for trunk/forum/includes/mcp/mcp_main.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/mcp/mcp_main.php
r400 r702 3 3 * 4 4 * @package mcp 5 * @version $Id : mcp_main.php 8950 2008-09-27 10:59:25Z toonarmy$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 569 569 $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; 570 570 } 571 else if (!$auth->acl_get('f_post', $to_forum_id) )571 else if (!$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id))) 572 572 { 573 573 $additional_msg = $user->lang['USER_CANNOT_POST']; … … 595 595 $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false; 596 596 597 $topics_moved = sizeof($topic_ids);598 $topics_authed_moved = 0;599 597 $forum_sync_data = array(); 600 598 … … 602 600 $forum_sync_data[$to_forum_id] = $forum_data; 603 601 602 // Real topics added to target forum 603 $topics_moved = sizeof($topic_data); 604 605 // Approved topics added to target forum 606 $topics_authed_moved = 0; 607 608 // Posts (topic replies + topic post if approved) added to target forum 609 $topic_posts_added = 0; 610 611 // Posts (topic replies + topic post if approved and not global announcement) removed from source forum 612 $topic_posts_removed = 0; 613 614 // Real topics removed from source forum (all topics without global announcements) 615 $topics_removed = 0; 616 617 // Approved topics removed from source forum (except global announcements) 618 $topics_authed_removed = 0; 619 604 620 foreach ($topic_data as $topic_id => $topic_info) 605 621 { 606 if ($topic_info['topic_approved'] == '1')622 if ($topic_info['topic_approved']) 607 623 { 608 624 $topics_authed_moved++; 625 $topic_posts_added++; 626 } 627 628 $topic_posts_added += $topic_info['topic_replies']; 629 630 if ($topic_info['topic_type'] != POST_GLOBAL) 631 { 632 $topics_removed++; 633 $topic_posts_removed += $topic_info['topic_replies']; 634 635 if ($topic_info['topic_approved']) 636 { 637 $topics_authed_removed++; 638 $topic_posts_removed++; 639 } 609 640 } 610 641 } … … 612 643 $db->sql_transaction('begin'); 613 644 614 $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts615 FROM ' . TOPICS_TABLE . ' t616 WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);617 $result = $db->sql_query($sql);618 $row_data = $db->sql_fetchrow($result);619 $db->sql_freeresult($result);620 621 645 $sync_sql = array(); 622 646 623 if ($row_data['topic_posts']) 624 { 625 $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts']; 626 $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts']; 647 if ($topic_posts_added) 648 { 649 $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $topic_posts_added; 627 650 } 628 651 629 652 if ($topics_authed_moved) 630 653 { 631 $sync_sql[$to_forum_id][] 632 } 633 634 $sync_sql[$to_forum_id][] 654 $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $topics_authed_moved; 655 } 656 657 $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved; 635 658 636 659 // Move topics, but do not resync yet … … 693 716 $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); 694 717 695 $topics_authed_moved--; 696 $topics_moved--; 718 // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts 719 $topics_removed--; 720 $topics_authed_removed--; 697 721 } 698 722 } 699 723 unset($topic_data); 700 724 701 $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) $topics_moved; 702 703 if ($topics_authed_moved) 704 { 705 $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $topics_authed_moved; 725 if ($topic_posts_removed) 726 { 727 $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . $topic_posts_removed; 728 } 729 730 if ($topics_removed) 731 { 732 $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) $topics_removed; 733 } 734 735 if ($topics_authed_removed) 736 { 737 $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $topics_authed_removed; 706 738 } 707 739 … … 782 814 foreach ($data as $topic_id => $row) 783 815 { 784 add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_' . ($row['topic_moved_id'] ? 'SHADOW_' : '') . 'TOPIC', $row['topic_title']); 816 if ($row['topic_moved_id']) 817 { 818 add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_SHADOW_TOPIC', $row['topic_title']); 819 } 820 else 821 { 822 add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); 823 } 785 824 } 786 825 … … 866 905 foreach ($post_data as $id => $row) 867 906 { 868 add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject']); 907 $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; 908 add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username); 869 909 } 870 910 … … 930 970 else 931 971 { 972 if ($affected_topics != 1 || $deleted_topics || !$topic_id) 973 { 974 $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", false); 975 } 976 932 977 meta_refresh(3, $redirect); 933 978 trigger_error($success_msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link)); … … 1028 1073 'poll_title' => (string) $topic_row['poll_title'], 1029 1074 'poll_start' => (int) $topic_row['poll_start'], 1030 'poll_length' => (int) $topic_row['poll_length'] 1075 'poll_length' => (int) $topic_row['poll_length'], 1076 'poll_max_options' => (int) $topic_row['poll_max_options'], 1077 'poll_vote_change' => (int) $topic_row['poll_vote_change'], 1031 1078 ); 1032 1079 … … 1130 1177 'is_orphan' => (int) $attach_row['is_orphan'], 1131 1178 'poster_id' => (int) $attach_row['poster_id'], 1132 'physical_filename' => (string) basename($attach_row['physical_filename']),1133 'real_filename' => (string) basename($attach_row['real_filename']),1179 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), 1180 'real_filename' => (string) utf8_basename($attach_row['real_filename']), 1134 1181 'download_count' => (int) $attach_row['download_count'], 1135 1182 'attach_comment' => (string) $attach_row['attach_comment'], … … 1190 1237 1191 1238 sync('forum', 'forum_id', $to_forum_id); 1192 set_config ('num_topics', $config['num_topics'] +sizeof($new_topic_id_list), true);1193 set_config ('num_posts', $config['num_posts'] +$total_posts, true);1239 set_config_count('num_topics', sizeof($new_topic_id_list), true); 1240 set_config_count('num_posts', $total_posts, true); 1194 1241 1195 1242 foreach ($new_topic_id_list as $topic_id => $new_topic_id)
Note:
See TracChangeset
for help on using the changeset viewer.