Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/includes/mcp/mcp_main.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_main.php 8950 2008-09-27 10:59:25Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    569569                                $additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
    570570                        }
    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)))
    572572                        {
    573573                                $additional_msg = $user->lang['USER_CANNOT_POST'];
     
    595595                $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false;
    596596
    597                 $topics_moved = sizeof($topic_ids);
    598                 $topics_authed_moved = 0;
    599597                $forum_sync_data = array();
    600598
     
    602600                $forum_sync_data[$to_forum_id] = $forum_data;
    603601
     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
    604620                foreach ($topic_data as $topic_id => $topic_info)
    605621                {
    606                         if ($topic_info['topic_approved'] == '1')
     622                        if ($topic_info['topic_approved'])
    607623                        {
    608624                                $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                                }
    609640                        }
    610641                }
     
    612643                $db->sql_transaction('begin');
    613644
    614                 $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts
    615                         FROM ' . TOPICS_TABLE . ' t
    616                         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 
    621645                $sync_sql = array();
    622646
    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;
    627650                }
    628651
    629652                if ($topics_authed_moved)
    630653                {
    631                         $sync_sql[$to_forum_id][]       = 'forum_topics = forum_topics + ' . (int) $topics_authed_moved;
    632                 }
    633 
    634                 $sync_sql[$to_forum_id][]       = 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved;
     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;
    635658
    636659                // Move topics, but do not resync yet
     
    693716                                $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
    694717
    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--;
    697721                        }
    698722                }
    699723                unset($topic_data);
    700724
    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;
    706738                }
    707739
     
    782814                foreach ($data as $topic_id => $row)
    783815                {
    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                        }
    785824                }
    786825
     
    866905                foreach ($post_data as $id => $row)
    867906                {
    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);
    869909                }
    870910
     
    930970        else
    931971        {
     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
    932977                meta_refresh(3, $redirect);
    933978                trigger_error($success_msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link));
     
    10281073                                'poll_title'                            => (string) $topic_row['poll_title'],
    10291074                                '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'],
    10311078                        );
    10321079
     
    11301177                                                        'is_orphan'                     => (int) $attach_row['is_orphan'],
    11311178                                                        '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']),
    11341181                                                        'download_count'        => (int) $attach_row['download_count'],
    11351182                                                        'attach_comment'        => (string) $attach_row['attach_comment'],
     
    11901237
    11911238                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);
    11941241
    11951242                foreach ($new_topic_id_list as $topic_id => $new_topic_id)
Note: See TracChangeset for help on using the changeset viewer.