Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
Location:
trunk/forum/includes/mcp
Files:
8 edited

Legend:

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

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_front.php 9029 2008-10-18 18:44:41Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3535
    3636                $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
    37                
     37
    3838                if (!empty($forum_list))
    3939                {
     
    120120                        }
    121121
     122                        $s_hidden_fields = build_hidden_fields(array(
     123                                'redirect'              => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main' . (($forum_id) ? '&f=' . $forum_id : ''))
     124                        ));
     125
    122126                        $template->assign_vars(array(
     127                                'S_HIDDEN_FIELDS'               => $s_hidden_fields,
    123128                                'S_MCP_QUEUE_ACTION'    => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
    124129                        ));
     
    153158                                FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
    154159                                WHERE r.post_id = p.post_id
     160                                        AND r.pm_id = 0
    155161                                        AND r.report_closed = 0
    156162                                        AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
     
    182188
    183189                                        'WHERE'         => 'r.post_id = p.post_id
     190                                                AND r.pm_id = 0
    184191                                                AND r.report_closed = 0
    185192                                                AND r.reason_id = rr.reason_id
     
    241248                                );
    242249                        }
     250                }
     251        }
     252
     253        // Latest 5 reported PMs
     254        if ($module->loaded('pm_reports') && $auth->acl_getf_global('m_report'))
     255        {
     256                $template->assign_var('S_SHOW_PM_REPORTS', true);
     257                $user->add_lang(array('ucp'));
     258
     259                $sql = 'SELECT COUNT(r.report_id) AS total
     260                        FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p
     261                        WHERE r.post_id = 0
     262                                AND r.pm_id = p.msg_id
     263                                AND r.report_closed = 0';
     264                $result = $db->sql_query($sql);
     265                $total = (int) $db->sql_fetchfield('total');
     266                $db->sql_freeresult($result);
     267
     268                if ($total)
     269                {
     270                        include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
     271
     272                        $sql = $db->sql_build_query('SELECT', array(
     273                                'SELECT'        => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id',
     274
     275                                'FROM'          => array(
     276                                        REPORTS_TABLE                   => 'r',
     277                                        REPORTS_REASONS_TABLE   => 'rr',
     278                                        USERS_TABLE                             => array('u', 'u2'),
     279                                        PRIVMSGS_TABLE                          => 'p'
     280                                ),
     281
     282                                'WHERE'         => 'r.pm_id = p.msg_id
     283                                        AND r.post_id = 0
     284                                        AND r.report_closed = 0
     285                                        AND r.reason_id = rr.reason_id
     286                                        AND r.user_id = u.user_id
     287                                        AND p.author_id = u2.user_id',
     288
     289                                'ORDER_BY'      => 'p.message_time DESC'
     290                        ));
     291                        $result = $db->sql_query_limit($sql, 5);
     292
     293                        $pm_by_id = $pm_list = array();
     294                        while ($row = $db->sql_fetchrow($result))
     295                        {
     296                                $pm_by_id[(int) $row['msg_id']] = $row;
     297                                $pm_list[] = (int) $row['msg_id'];
     298                        }
     299
     300                        $address_list = get_recipient_strings($pm_by_id);
     301
     302                        foreach ($pm_list as $message_id)
     303                        {
     304                                $row = $pm_by_id[$message_id];
     305
     306                                $template->assign_block_vars('pm_report', array(
     307                                        'U_PM_DETAILS'  => append_sid("{$phpbb_root_path}mcp.$phpEx", 'r=' . $row['report_id'] . "&i=pm_reports&mode=pm_report_details"),
     308
     309                                        'REPORTER_FULL'         => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
     310                                        'REPORTER'                      => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
     311                                        'REPORTER_COLOUR'       => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
     312                                        'U_REPORTER'            => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
     313
     314                                        'PM_AUTHOR_FULL'                => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']),
     315                                        'PM_AUTHOR'                     => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']),
     316                                        'PM_AUTHOR_COLOUR'              => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
     317                                        'U_PM_AUTHOR'                   => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
     318
     319                                        'PM_SUBJECT'            => $row['message_subject'],
     320                                        'REPORT_TIME'           => $user->format_date($row['report_time']),
     321                                        'PM_TIME'                       => $user->format_date($row['message_time']),
     322                                        'RECIPIENTS'            => implode(', ', $address_list[$row['msg_id']]),
     323                                ));
     324                        }
     325                }
     326
     327                if ($total == 0)
     328                {
     329                        $template->assign_vars(array(
     330                                'L_PM_REPORTS_TOTAL'    =>      $user->lang['PM_REPORTS_ZERO_TOTAL'],
     331                                'S_HAS_PM_REPORTS'              =>      false)
     332                        );
     333                }
     334                else
     335                {
     336                        $template->assign_vars(array(
     337                                'L_PM_REPORTS_TOTAL'    => ($total == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total),
     338                                'S_HAS_PM_REPORTS'              => true)
     339                        );
    243340                }
    244341        }
  • trunk/forum/includes/mcp/mcp_logs.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_logs.php 9029 2008-10-18 18:44:41Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    165165                $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
    166166
     167                $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
     168                $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
     169
    167170                // Grab log data
    168171                $log_data = array();
    169172                $log_count = 0;
    170                 view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort);
     173                view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
    171174
    172175                $template->assign_vars(array(
    173176                        'PAGE_NUMBER'           => on_page($log_count, $config['topics_per_page'], $start),
    174177                        'TOTAL'                         => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count),
    175                         'PAGINATION'            => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start),
     178                        'PAGINATION'            => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start),
    176179
    177180                        'L_TITLE'                       => $user->lang['MCP_LOGS'],
     
    183186                        'S_SELECT_SORT_DAYS'    => $s_limit_days,
    184187                        'S_LOGS'                                => ($log_count > 0),
     188                        'S_KEYWORDS'                    => $keywords,
    185189                        )
    186190                );
     
    189193                {
    190194                        $data = array();
    191                                
     195
    192196                        $checks = array('viewtopic', 'viewforum');
    193197                        foreach ($checks as $check)
  • 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)
  • trunk/forum/includes/mcp/mcp_notes.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_notes.php 8598 2008-06-04 15:37:06Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    194194                $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
    195195
     196                $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
     197                $keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
     198
    196199                $log_data = array();
    197200                $log_count = 0;
    198                 view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
     201                view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords);
    199202
    200203                if ($log_count)
     
    220223                        'S_SELECT_SORT_KEY'             => $s_sort_key,
    221224                        'S_SELECT_SORT_DAYS'    => $s_limit_days,
     225                        'S_KEYWORDS'                    => $keywords,
    222226
    223227                        'L_TITLE'                       => $user->lang['MCP_NOTES_USER'],
    224228
    225                         'PAGE_NUMBER'           => on_page($log_count, $config['posts_per_page'], $start),
    226                         'PAGINATION'            => generate_pagination($this->u_action . "&amp;st=$st&amp;sk=$sk&amp;sd=$sd", $log_count, $config['posts_per_page'], $start),
     229                        'PAGE_NUMBER'           => on_page($log_count, $config['topics_per_page'], $start),
     230                        'PAGINATION'            => generate_pagination($this->u_action . "&amp;$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start),
    227231                        'TOTAL_REPORTS'         => ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count),
    228232
    229                         'USERNAME'                      => $userrow['username'],
    230                         'USER_COLOR'            => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '',
    231233                        'RANK_TITLE'            => $rank_title,
    232234                        'JOINED'                        => $user->format_date($userrow['user_regdate']),
    233235                        'POSTS'                         => ($userrow['user_posts']) ? $userrow['user_posts'] : 0,
    234236                        'WARNINGS'                      => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0,
     237
     238                        'USERNAME_FULL'         => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
     239                        'USERNAME_COLOUR'       => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
     240                        'USERNAME'                      => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
     241                        'U_PROFILE'                     => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
    235242
    236243                        'AVATAR_IMG'            => $avatar_img,
  • trunk/forum/includes/mcp/mcp_queue.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_queue.php 9133 2008-11-30 12:03:43Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    106106                                        $template->assign_vars(array(
    107107                                                'S_TOPIC_REVIEW'        => true,
     108                                                'S_BBCODE_ALLOWED'      => $post_info['enable_bbcode'],
    108109                                                'TOPIC_TITLE'           => $post_info['topic_title'])
    109110                                        );
     
    492493
    493494                $total_topics = $total_posts = 0;
    494                 $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
    495                 $user_posts_sql = array();
    496 
    497                 $update_forum_information = false;
     495                $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
     496                $user_posts_sql = $post_approved_list = array();
    498497
    499498                foreach ($post_info as $post_id => $post_data)
    500499                {
     500                        if ($post_data['post_approved'])
     501                        {
     502                                $post_approved_list[] = $post_id;
     503                                continue;
     504                        }
     505
    501506                        $topic_id_list[$post_data['topic_id']] = 1;
    502507
     
    518523                                if ($post_data['forum_id'])
    519524                                {
    520                                         if (!isset($forum_topics_posts[$post_data['forum_id']]))
    521                                         {
    522                                                 $forum_topics_posts[$post_data['forum_id']] = array(
    523                                                         'forum_posts'   => 0,
    524                                                         'forum_topics'  => 0
    525                                                 );
    526                                         }
    527 
    528525                                        $total_topics++;
    529                                         $forum_topics_posts[$post_data['forum_id']]['forum_topics']++;
    530526                                }
    531527                                $topic_approve_sql[] = $post_data['topic_id'];
     
    540536                        else
    541537                        {
    542                                 if (!isset($topic_replies_sql[$post_data['topic_id']]))
    543                                 {
    544                                         $topic_replies_sql[$post_data['topic_id']] = 0;
    545                                 }
    546                                 $topic_replies_sql[$post_data['topic_id']]++;
    547 
    548538                                $approve_log[] = array(
    549539                                        'type'                  => 'post',
     
    556546                        if ($post_data['forum_id'])
    557547                        {
    558                                 if (!isset($forum_topics_posts[$post_data['forum_id']]))
    559                                 {
    560                                         $forum_topics_posts[$post_data['forum_id']] = array(
    561                                                 'forum_posts'   => 0,
    562                                                 'forum_topics'  => 0
    563                                         );
    564                                 }
    565 
    566548                                $total_posts++;
    567                                 $forum_topics_posts[$post_data['forum_id']]['forum_posts']++;
    568549
    569550                                // Increment by topic_replies if we approve a topic...
     
    572553                                {
    573554                                        $total_posts += $post_data['topic_replies'];
    574                                         $forum_topics_posts[$post_data['forum_id']]['forum_posts'] += $post_data['topic_replies'];
    575555                                }
    576556                        }
    577557
    578558                        $post_approve_sql[] = $post_id;
    579 
    580                         // If the post is newer than the last post information stored we need to update the forum information
    581                         if ($post_data['post_time'] >= $post_data['forum_last_post_time'])
    582                         {
    583                                 $update_forum_information = true;
    584                         }
     559                }
     560
     561                $post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
     562                for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
     563                {
     564                        unset($post_info[$post_approved_list[$i]]);
    585565                }
    586566
     
    601581                }
    602582
     583                unset($topic_approve_sql, $post_approve_sql);
     584
    603585                foreach ($approve_log as $log_data)
    604586                {
    605587                        add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']);
    606                 }
    607 
    608                 if (sizeof($topic_replies_sql))
    609                 {
    610                         foreach ($topic_replies_sql as $topic_id => $num_replies)
    611                         {
    612                                 $sql = 'UPDATE ' . TOPICS_TABLE . "
    613                                         SET topic_replies = topic_replies + $num_replies
    614                                         WHERE topic_id = $topic_id";
    615                                 $db->sql_query($sql);
    616                         }
    617                 }
    618 
    619                 if (sizeof($forum_topics_posts))
    620                 {
    621                         foreach ($forum_topics_posts as $forum_id => $row)
    622                         {
    623                                 $sql = 'UPDATE ' . FORUMS_TABLE . '
    624                                         SET ';
    625                                 $sql .= ($row['forum_topics']) ? "forum_topics = forum_topics + {$row['forum_topics']}" : '';
    626                                 $sql .= ($row['forum_topics'] && $row['forum_posts']) ? ', ' : '';
    627                                 $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : '';
    628                                 $sql .= " WHERE forum_id = $forum_id";
    629 
    630                                 $db->sql_query($sql);
    631                         }
    632588                }
    633589
     
    653609                if ($total_topics)
    654610                {
    655                         set_config('num_topics', $config['num_topics'] + $total_topics, true);
     611                        set_config_count('num_topics', $total_topics, true);
    656612                }
    657613
    658614                if ($total_posts)
    659615                {
    660                         set_config('num_posts', $config['num_posts'] + $total_posts, true);
    661                 }
    662                 unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
    663 
    664                 update_post_information('topic', array_keys($topic_id_list));
    665 
    666                 if ($update_forum_information)
    667                 {
    668                         update_post_information('forum', array_keys($forum_id_list));
    669                 }
     616                        set_config_count('num_posts', $total_posts, true);
     617                }
     618
     619                sync('topic', 'topic_id', array_keys($topic_id_list), true);
     620                sync('forum', 'forum_id', array_keys($forum_id_list), true, true);
    670621                unset($topic_id_list, $forum_id_list);
    671622
     
    734685                else
    735686                {
    736                         $success_msg = (sizeof($post_id_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
     687                        $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
    737688                }
    738689        }
     
    846797        if (confirm_box(true))
    847798        {
    848 
    849                 // If Topic -> forum_topics_real -= 1
    850                 // If Post -> topic_replies_real -= 1
    851 
    852                 $num_disapproved = 0;
    853                 $forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = $disapprove_log = array();
    854 
     799                $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
     800                $topic_replies_real = $post_disapprove_list = array();
     801
     802                // Build a list of posts to be unapproved and get the related topics real replies count
    855803                foreach ($post_info as $post_id => $post_data)
    856804                {
    857                         $topic_id_list[$post_data['topic_id']] = 1;
    858 
    859                         if ($post_data['forum_id'])
    860                         {
    861                                 $forum_id_list[$post_data['forum_id']] = 1;
    862                         }
    863 
    864                         // Topic or Post. ;)
    865                         /**
    866                         * @todo this probably is a different method than the one used by delete_posts, does this cause counter inconsistency?
    867                         */
    868                         if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id)
    869                         {
    870                                 if ($post_data['forum_id'])
    871                                 {
    872                                         if (!isset($forum_topics_real[$post_data['forum_id']]))
    873                                         {
    874                                                 $forum_topics_real[$post_data['forum_id']] = 0;
    875                                         }
    876                                         $forum_topics_real[$post_data['forum_id']]++;
    877                                         $num_disapproved++;
    878                                 }
    879 
    880                                 $disapprove_log[] = array(
    881                                         'type'                  => 'topic',
    882                                         'post_subject'  => $post_data['post_subject'],
    883                                         'forum_id'              => $post_data['forum_id'],
    884                                         'topic_id'              => 0, // useless to log a topic id, as it will be deleted
     805                        $post_disapprove_list[$post_id] = $post_data['topic_id'];
     806                        if (!isset($topic_replies_real[$post_data['topic_id']]))
     807                        {
     808                                $topic_replies_real[$post_data['topic_id']] = $post_data['topic_replies_real'];
     809                        }
     810                }
     811
     812                // Now we build the log array
     813                foreach ($post_disapprove_list as $post_id => $topic_id)
     814                {
     815                        // If the count of disapproved posts for the topic is greater
     816                        // than topic's real replies count, the whole topic is disapproved/deleted
     817                        if (sizeof(array_keys($post_disapprove_list, $topic_id)) > $topic_replies_real[$topic_id])
     818                        {
     819                                // Don't write the log more than once for every topic
     820                                if (!isset($disapprove_log_topics[$topic_id]))
     821                                {
     822                                        // Build disapproved topics log
     823                                        $disapprove_log_topics[$topic_id] = array(
     824                                                'type'                  => 'topic',
     825                                                'post_subject'  => $post_info[$post_id]['topic_title'],
     826                                                'forum_id'              => $post_info[$post_id]['forum_id'],
     827                                                'topic_id'              => 0, // useless to log a topic id, as it will be deleted
     828                                        );
     829                                }
     830                        }
     831                        else
     832                        {
     833                                // Build disapproved posts log
     834                                $disapprove_log_posts[] = array(
     835                                        'type'                  => 'post',
     836                                        'post_subject'  => $post_info[$post_id]['post_subject'],
     837                                        'forum_id'              => $post_info[$post_id]['forum_id'],
     838                                        'topic_id'              => $post_info[$post_id]['topic_id'],
    885839                                );
    886                         }
    887                         else
    888                         {
    889                                 if (!isset($topic_replies_real_sql[$post_data['topic_id']]))
    890                                 {
    891                                         $topic_replies_real_sql[$post_data['topic_id']] = 0;
    892                                 }
    893                                 $topic_replies_real_sql[$post_data['topic_id']]++;
    894 
    895                                 $disapprove_log[] = array(
    896                                         'type'                  => 'post',
    897                                         'post_subject'  => $post_data['post_subject'],
    898                                         'forum_id'              => $post_data['forum_id'],
    899                                         'topic_id'              => $post_data['topic_id'],
    900                                 );
    901                         }
    902 
    903                         $post_disapprove_sql[] = $post_id;
    904                 }
    905 
    906                 unset($post_data);
    907 
    908                 if (sizeof($forum_topics_real))
    909                 {
    910                         foreach ($forum_topics_real as $forum_id => $topics_real)
    911                         {
    912                                 $sql = 'UPDATE ' . FORUMS_TABLE . "
    913                                         SET forum_topics_real = forum_topics_real - $topics_real
    914                                         WHERE forum_id = $forum_id";
    915                                 $db->sql_query($sql);
    916                         }
    917                 }
    918 
    919                 if (sizeof($topic_replies_real_sql))
    920                 {
    921                         foreach ($topic_replies_real_sql as $topic_id => $num_replies)
    922                         {
    923                                 $sql = 'UPDATE ' . TOPICS_TABLE . "
    924                                         SET topic_replies_real = topic_replies_real - $num_replies
    925                                         WHERE topic_id = $topic_id";
    926                                 $db->sql_query($sql);
    927                         }
    928                 }
    929 
    930                 if (sizeof($post_disapprove_sql))
     840
     841                        }
     842                }
     843
     844                // Get disapproved posts/topics counts separately
     845                $num_disapproved_topics = sizeof($disapprove_log_topics);
     846                $num_disapproved_posts = sizeof($disapprove_log_posts);
     847
     848                // Build the whole log
     849                $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
     850
     851                // Unset unneeded arrays
     852                unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
     853
     854                // Let's do the job - delete disapproved posts
     855                if (sizeof($post_disapprove_list))
    931856                {
    932857                        if (!function_exists('delete_posts'))
     
    936861
    937862                        // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
    938                         delete_posts('post_id', $post_disapprove_sql);
     863                        // Note: function delete_posts triggers related forums/topics sync,
     864                        // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually
     865                        delete_posts('post_id', array_keys($post_disapprove_list));
    939866
    940867                        foreach ($disapprove_log as $log_data)
     
    943870                        }
    944871                }
    945                 unset($post_disapprove_sql, $topic_replies_real_sql);
    946 
    947                 update_post_information('topic', array_keys($topic_id_list));
    948 
    949                 if (sizeof($forum_id_list))
    950                 {
    951                         update_post_information('forum', array_keys($forum_id_list));
    952                 }
    953                 unset($topic_id_list, $forum_id_list);
    954872
    955873                $messenger = new messenger();
     
    980898                                                        // Load up the language pack
    981899                                                        $lang = array();
    982                                                         @include($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx);
     900                                                        @include($phpbb_root_path . '/language/' . basename($post_data['user_lang']) . '/mcp.' . $phpEx);
    983901
    984902                                                        // If we find the reason in this language pack use it
     
    1019937                $messenger->save_queue();
    1020938
    1021                 if (sizeof($forum_topics_real))
    1022                 {
    1023                         $success_msg = ($num_disapproved == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
     939                if ($num_disapproved_topics)
     940                {
     941                        $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
    1024942                }
    1025943                else
    1026944                {
    1027                         $success_msg = (sizeof($post_id_list) == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
     945                        $success_msg = ($num_disapproved_posts == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
    1028946                }
    1029947        }
  • trunk/forum/includes/mcp/mcp_reports.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_reports.php 9015 2008-10-14 18:29:50Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    7878                                                AND rr.reason_id = r.reason_id
    7979                                                AND r.user_id = u.user_id
     80                                                AND r.pm_id = 0
    8081                                        ORDER BY report_closed ASC';
    8182                                $result = $db->sql_query_limit($sql, 1);
     
    116117                                        $template->assign_vars(array(
    117118                                                'S_TOPIC_REVIEW'        => true,
     119                                                'S_BBCODE_ALLOWED'      => $post_info['enable_bbcode'],
    118120                                                'TOPIC_TITLE'           => $post_info['topic_title'])
    119121                                        );
     
    150152                                if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
    151153                                {
    152                                         $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
    153 
    154154                                        $sql = 'SELECT *
    155155                                                FROM ' . ATTACHMENTS_TABLE . '
    156156                                                WHERE post_msg_id = ' . $post_id . '
    157157                                                        AND in_message = 0
    158                                                 ORDER BY filetime DESC, post_msg_id ASC';
     158                                                ORDER BY filetime DESC';
    159159                                        $result = $db->sql_query($sql);
    160160
     
    259259                                unset($forum_list_read);
    260260
    261                                 if ($topic_id && $forum_id)
     261                                if ($topic_id)
    262262                                {
    263263                                        $topic_info = get_topic_data(array($topic_id));
     
    268268                                        }
    269269
    270                                         $topic_info = $topic_info[$topic_id];
    271                                         $forum_id = $topic_info['forum_id'];
    272                                 }
    273                                 else if ($topic_id && !$forum_id)
    274                                 {
    275                                         $topic_id = 0;
     270                                        if ($forum_id != $topic_info[$topic_id]['forum_id'])
     271                                        {
     272                                                $topic_id = 0;
     273                                        }
     274                                        else
     275                                        {
     276                                                $topic_info = $topic_info[$topic_id];
     277                                                $forum_id = (int) $topic_info['forum_id'];
     278                                        }
    276279                                }
    277280
     
    330333
    331334                                $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
    332                                 $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
     335                                $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
    333336
    334337                                if ($mode == 'reports')
     
    347350                                                AND r.post_id = p.post_id
    348351                                                " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
    349                                                 ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = p.poster_id' : '') . '
     352                                                ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . '
    350353                                                ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
    351354                                                AND t.topic_id = p.topic_id
     355                                                AND r.pm_id = 0
    352356                                                $limit_time_sql
    353357                                        ORDER BY $sort_order_sql";
     
    372376                                                        AND u.user_id = p.poster_id
    373377                                                        AND ru.user_id = r.user_id
     378                                                        AND r.pm_id = 0
    374379                                                ORDER BY ' . $sort_order_sql;
    375380                                        $result = $db->sql_query($sql);
     
    426431                                        'TOPIC_ID'                              => $topic_id,
    427432                                        'TOTAL'                                 => $total,
    428                                         'TOTAL_REPORTS'                 => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),                                   
     433                                        'TOTAL_REPORTS'                 => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
    429434                                        )
    430435                                );
     
    439444* Closes a report
    440445*/
    441 function close_report($report_id_list, $mode, $action)
     446function close_report($report_id_list, $mode, $action, $pm = false)
    442447{
    443         global $db, $template, $user, $config;
     448        global $db, $template, $user, $config, $auth;
    444449        global $phpEx, $phpbb_root_path;
    445450
    446         $sql = 'SELECT r.post_id
    447                 FROM ' . REPORTS_TABLE . ' r
    448                 WHERE ' . $db->sql_in_set('r.report_id', $report_id_list);
     451        $pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
     452        $id_column = ($pm) ? 'pm_id' : 'post_id';
     453        $module = ($pm) ? 'pm_reports' : 'reports';
     454        $pm_prefix = ($pm) ? 'PM_' : '';
     455
     456        $sql = "SELECT r.$id_column
     457                FROM " . REPORTS_TABLE . ' r
     458                WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where;
    449459        $result = $db->sql_query($sql);
    450460
     
    452462        while ($row = $db->sql_fetchrow($result))
    453463        {
    454                 $post_id_list[] = $row['post_id'];
     464                $post_id_list[] = $row[$id_column];
    455465        }
    456466        $post_id_list = array_unique($post_id_list);
    457467
    458         if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
    459         {
    460                 trigger_error('NOT_AUTHORISED');
     468        if ($pm)
     469        {
     470                if (!$auth->acl_getf_global('m_report'))
     471                {
     472                        trigger_error('NOT_AUTHORISED');
     473                }
     474        }
     475        else
     476        {
     477                if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
     478                {
     479                        trigger_error('NOT_AUTHORISED');
     480                }
    461481        }
    462482
     
    465485                $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=reports');
    466486        }
     487        elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false)
     488        {
     489                $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=pm_reports');
     490        }
    467491        else if ($action == 'close' && !request_var('r', 0))
    468492        {
    469                 $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=reports');
     493                $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=' . $module);
    470494        }
    471495        else
     
    478502
    479503        $s_hidden_fields = build_hidden_fields(array(
    480                 'i'                                     => 'reports',
     504                'i'                                     => $module,
    481505                'mode'                          => $mode,
    482506                'report_id_list'        => $report_id_list,
     
    487511        if (confirm_box(true))
    488512        {
    489                 $post_info = get_post_data($post_id_list, 'm_report');
    490 
    491                 $sql = 'SELECT r.report_id, r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
    492                         FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
     513                $post_info = ($pm) ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report');
     514
     515                $sql = "SELECT r.report_id, r.$id_column, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
     516                        FROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
    493517                        WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . '
    494518                                ' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . '
    495                                 AND r.user_id = u.user_id';
     519                                AND r.user_id = u.user_id' . $pm_where;
    496520                $result = $db->sql_query($sql);
    497521
     
    504528                        if (!$report['report_closed'])
    505529                        {
    506                                 $close_report_posts[] = $report['post_id'];
    507                                 $close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
     530                                $close_report_posts[] = $report[$id_column];
     531
     532                                if (!$pm)
     533                                {
     534                                        $close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
     535                                }
    508536                        }
    509537
     
    520548                        $close_report_topics = array_unique($close_report_topics);
    521549
    522                         if (sizeof($close_report_posts))
     550                        if (!$pm && sizeof($close_report_posts))
    523551                        {
    524552                                // Get a list of topics that still contain reported posts
     
    559587                        if (sizeof($close_report_posts))
    560588                        {
    561                                 $sql = 'UPDATE ' . POSTS_TABLE . '
    562                                         SET post_reported = 0
    563                                         WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
    564                                 $db->sql_query($sql);
    565 
    566                                 if (sizeof($close_report_topics))
    567                                 {
    568                                         $sql = 'UPDATE ' . TOPICS_TABLE . '
    569                                                 SET topic_reported = 0
    570                                                 WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
    571                                                         OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics);
     589                                if ($pm)
     590                                {
     591                                        $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
     592                                                SET message_reported = 0
     593                                                WHERE ' . $db->sql_in_set('msg_id', $close_report_posts);
    572594                                        $db->sql_query($sql);
     595
     596                                        if ($action == 'delete')
     597                                        {
     598                                                delete_pm(ANONYMOUS, $close_report_posts, PRIVMSGS_INBOX);
     599                                        }
     600                                }
     601                                else
     602                                {
     603                                        $sql = 'UPDATE ' . POSTS_TABLE . '
     604                                                SET post_reported = 0
     605                                                WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
     606                                        $db->sql_query($sql);
     607
     608                                        if (sizeof($close_report_topics))
     609                                        {
     610                                                $sql = 'UPDATE ' . TOPICS_TABLE . '
     611                                                        SET topic_reported = 0
     612                                                        WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
     613                                                                OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics);
     614                                                $db->sql_query($sql);
     615                                        }
    573616                                }
    574617                        }
     
    580623                foreach ($reports as $report)
    581624                {
    582                         add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' .  strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
     625                        if ($pm)
     626                        {
     627                                add_log('mod', 0, 0, 'LOG_PM_REPORT_' .  strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
     628                        }
     629                        else
     630                        {
     631                                add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' .  strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
     632                        }
    583633                }
    584634
     
    595645                                }
    596646
    597                                 $post_id = $reporter['post_id'];
    598 
    599                                 $messenger->template('report_' . $action . 'd', $reporter['user_lang']);
     647                                $post_id = $reporter[$id_column];
     648
     649                                $messenger->template((($pm) ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']);
    600650
    601651                                $messenger->to($reporter['user_email'], $reporter['username']);
    602652                                $messenger->im($reporter['user_jabber'], $reporter['username']);
    603653
    604                                 $messenger->assign_vars(array(
    605                                         'USERNAME'              => htmlspecialchars_decode($reporter['username']),
    606                                         'CLOSER_NAME'   => htmlspecialchars_decode($user->data['username']),
    607                                         'POST_SUBJECT'  => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
    608                                         'TOPIC_TITLE'   => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
    609                                 );
     654                                if ($pm)
     655                                {
     656                                        $messenger->assign_vars(array(
     657                                                'USERNAME'              => htmlspecialchars_decode($reporter['username']),
     658                                                'CLOSER_NAME'   => htmlspecialchars_decode($user->data['username']),
     659                                                'PM_SUBJECT'    => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject'])),
     660                                        ));
     661                                }
     662                                else
     663                                {
     664                                        $messenger->assign_vars(array(
     665                                                'USERNAME'              => htmlspecialchars_decode($reporter['username']),
     666                                                'CLOSER_NAME'   => htmlspecialchars_decode($user->data['username']),
     667                                                'POST_SUBJECT'  => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
     668                                                'TOPIC_TITLE'   => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
     669                                        );
     670                                }
    610671
    611672                                $messenger->send($reporter['user_notify_type']);
    612673                        }
    613674                }
    614                
    615                 foreach ($post_info as $post)
    616                 {
    617                         $forum_ids[$post['forum_id']] = $post['forum_id'];
    618                         $topic_ids[$post['topic_id']] = $post['topic_id'];
    619                 }
    620                
     675
     676                if (!$pm)
     677                {
     678                        foreach ($post_info as $post)
     679                        {
     680                                $forum_ids[$post['forum_id']] = $post['forum_id'];
     681                                $topic_ids[$post['topic_id']] = $post['topic_id'];
     682                        }
     683                }
     684
    621685                unset($notify_reporters, $post_info, $reports);
    622686
    623687                $messenger->save_queue();
    624688
    625                 $success_msg = (sizeof($report_id_list) == 1) ? 'REPORT_' . strtoupper($action) . 'D_SUCCESS' : 'REPORTS_' . strtoupper($action) . 'D_SUCCESS';
     689                $success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
    626690        }
    627691        else
    628692        {
    629                 confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
     693                confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
    630694        }
    631695
     
    640704        {
    641705                meta_refresh(3, $redirect);
     706
    642707                $return_forum = '';
    643                 if (sizeof($forum_ids == 1))
    644                 {
    645                         $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
    646                 }
    647708                $return_topic = '';
    648                 if (sizeof($topic_ids == 1))
    649                 {
    650                         $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . '&amp;f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
    651                 }
    652                
     709
     710                if (!$pm)
     711                {
     712                        if (sizeof($forum_ids) === 1)
     713                        {
     714                                $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
     715                        }
     716
     717                        if (sizeof($topic_ids) === 1)
     718                        {
     719                                $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . '&amp;f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
     720                        }
     721                }
     722
    653723                trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
    654724        }
  • trunk/forum/includes/mcp/mcp_topic.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_topic.php 9030 2008-10-19 18:32:11Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    107107        if ($total == -1)
    108108        {
    109                 $total = $topic_info['topic_replies'] + 1;
     109                if ($auth->acl_get('m_approve', $topic_info['forum_id']))
     110                {
     111                        $total = $topic_info['topic_replies_real'] + 1;
     112                }
     113                else
     114                {
     115                        $total = $topic_info['topic_replies'] + 1;
     116                }
    110117        }
    111118
     
    260267        $s_topic_icons = false;
    261268
    262         if ($auth->acl_get('m_split', $topic_info['forum_id']))
     269        if ($auth->acl_gets('m_split', 'm_merge', (int) $topic_info['forum_id']))
    263270        {
    264271                include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
     
    302309                'ACTION'                        => $action,
    303310
    304                 'REPORTED_IMG'          => $user->img('icon_topic_reported', 'POST_REPORTED', false, true),
    305                 'UNAPPROVED_IMG'        => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED', false, true),
     311                'REPORTED_IMG'          => $user->img('icon_topic_reported', 'POST_REPORTED'),
     312                'UNAPPROVED_IMG'        => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
     313                'INFO_IMG'                      => $user->img('icon_post_info', 'VIEW_INFO'),
    306314
    307315                'S_MCP_ACTION'          => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;start=$start",
     
    502510
    503511                // Update forum statistics
    504                 set_config('num_topics', $config['num_topics'] + 1, true);
     512                set_config_count('num_topics', 1, true);
    505513
    506514                // Link back to both topics
  • trunk/forum/includes/mcp/mcp_warn.php

    r400 r702  
    33*
    44* @package mcp
    5 * @version $Id: mcp_warn.php 9002 2008-10-11 17:01:43Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    205205                $sql = 'SELECT u.*, p.*
    206206                        FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
    207                         WHERE post_id = $post_id
     207                        WHERE p.post_id = $post_id
    208208                                AND u.user_id = p.poster_id";
    209209                $result = $db->sql_query($sql);
     
    421421                        'U_POST_ACTION'         => $this->u_action,
    422422
    423                         'USERNAME'                      => $user_row['username'],
    424                         'USER_COLOR'            => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
    425423                        'RANK_TITLE'            => $rank_title,
    426424                        'JOINED'                        => $user->format_date($user_row['user_regdate']),
    427425                        'POSTS'                         => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
    428426                        'WARNINGS'                      => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
     427
     428                        'USERNAME_FULL'         => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
     429                        'USERNAME_COLOUR'       => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
     430                        'USERNAME'                      => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
     431                        'U_PROFILE'                     => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
    429432
    430433                        'AVATAR_IMG'            => $avatar_img,
Note: See TracChangeset for help on using the changeset viewer.