当前位置: 首页>>代码示例>>PHP>>正文


PHP phpbb_get_forum_data函数代码示例

本文整理汇总了PHP中phpbb_get_forum_data函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_get_forum_data函数的具体用法?PHP phpbb_get_forum_data怎么用?PHP phpbb_get_forum_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phpbb_get_forum_data函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main


//.........这里部分代码省略.........
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_reports[$k]);
                    }
                }
                unset($forum_list_read);
                if ($topic_id) {
                    $topic_info = phpbb_get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error('TOPIC_NOT_EXIST');
                    }
                    if ($forum_id != $topic_info[$topic_id]['forum_id']) {
                        $topic_id = 0;
                    } else {
                        $topic_info = $topic_info[$topic_id];
                        $forum_id = (int) $topic_info['forum_id'];
                    }
                }
                $forum_list = array();
                if (!$forum_id) {
                    foreach ($forum_list_reports as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!sizeof($forum_list)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $global_id = $forum_list[0];
                    $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_list);
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = phpbb_get_forum_data(array($forum_id), 'm_report');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = array($forum_id);
                }
                $forum_list[] = 0;
                $forum_data = array();
                $pagination = $phpbb_container->get('pagination');
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_reports as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . $row['forum_name'] . '</option>';
                    $forum_data[$row['forum_id']] = $row;
                }
                unset($forum_list_reports);
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics_approved'] : $total;
                $limit_time_sql = $sort_days ? 'AND r.report_time >= ' . (time() - $sort_days * 86400) : '';
                if ($mode == 'reports') {
                    $report_state = 'AND p.post_reported = 1 AND r.report_closed = 0';
                } else {
                    $report_state = 'AND r.report_closed = 1';
                }
                $sql = 'SELECT r.report_id
					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . ($sort_order_sql[0] == 'r' ? ', ' . USERS_TABLE . ' ru' : '') . '
					WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . "\n\t\t\t\t\t\t{$report_state}\n\t\t\t\t\t\tAND r.post_id = p.post_id\n\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
						' . ($sort_order_sql[0] == 'r' ? 'AND ru.user_id = r.user_id' : '') . '
						' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\tAND r.pm_id = 0\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
                /**
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:mcp_reports.php

示例2: main


//.........这里部分代码省略.........
             $soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true));
             break;
         case 'delete_post':
             $user->add_lang('posting');
             // f parameter is not reliable for permission usage, however we just use it to decide
             // which permission we will check later on. So if it is manipulated, we will still catch it later on.
             $forum_id = $request->variable('f', 0);
             $post_ids = !$quickmod ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
             $soft_delete = $request->is_set_post('confirm') && !$request->is_set_post('delete_permanent') || !$auth->acl_get('m_delete', $forum_id) ? true : false;
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true));
             break;
         case 'restore_topic':
             $user->add_lang('posting');
             $topic_ids = !$quickmod ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_restore_topic($topic_ids);
             break;
         default:
             /**
              * This event allows you to handle custom quickmod options
              *
              * @event core.modify_quickmod_actions
              * @var	string	action		Topic quick moderation action name
              * @var	bool	quickmod	Flag indicating whether MCP is in quick moderation mode
              * @since 3.1.0-a4
              * @change 3.1.0-RC4 Added variables: action, quickmod
              */
             $vars = array('action', 'quickmod');
             extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
             break;
     }
     switch ($mode) {
         case 'front':
             include $phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx;
             $user->add_lang('acp/common');
             mcp_front_view($id, $mode, $action);
             $this->tpl_name = 'mcp_front';
             $this->page_title = 'MCP_MAIN';
             break;
         case 'forum_view':
             include $phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx;
             $user->add_lang('viewforum');
             $forum_id = $request->variable('f', 0);
             $forum_info = phpbb_get_forum_data($forum_id, 'm_', true);
             if (!sizeof($forum_info)) {
                 $this->main('main', 'front');
                 return;
             }
             $forum_info = $forum_info[$forum_id];
             mcp_forum_view($id, $mode, $action, $forum_info);
             $this->tpl_name = 'mcp_forum';
             $this->page_title = 'MCP_MAIN_FORUM_VIEW';
             break;
         case 'topic_view':
             include $phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx;
             mcp_topic_view($id, $mode, $action);
             $this->tpl_name = 'mcp_topic';
             $this->page_title = 'MCP_MAIN_TOPIC_VIEW';
             break;
         case 'post_details':
             include $phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx;
             mcp_post_details($id, $mode, $action);
             $this->tpl_name = $action == 'whois' ? 'mcp_whois' : 'mcp_post';
             $this->page_title = 'MCP_MAIN_POST_DETAILS';
             break;
         default:
             if ($quickmod) {
                 switch ($action) {
                     case 'lock':
                     case 'unlock':
                     case 'make_announce':
                     case 'make_sticky':
                     case 'make_global':
                     case 'make_normal':
                     case 'make_onindex':
                     case 'move':
                     case 'fork':
                     case 'delete_topic':
                         trigger_error('TOPIC_NOT_EXIST');
                         break;
                     case 'lock_post':
                     case 'unlock_post':
                     case 'delete_post':
                         trigger_error('POST_NOT_EXIST');
                         break;
                 }
             }
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
 }
开发者ID:tqangxl,项目名称:phpbb,代码行数:101,代码来源:mcp_main.php

示例3: split_topic

/**
* Split topic
*/
function split_topic($action, $topic_id, $to_forum_id, $subject)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;
    $post_id_list = request_var('post_id_list', array(0));
    $forum_id = request_var('forum_id', 0);
    $start = request_var('start', 0);
    if (!sizeof($post_id_list)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) {
        return;
    }
    $post_id = $post_id_list[0];
    $post_info = phpbb_get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    $post_info = $post_info[$post_id];
    $subject = trim($subject);
    // Make some tests
    if (!$subject) {
        $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']);
        return;
    }
    if ($to_forum_id <= 0) {
        $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']);
        return;
    }
    $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post');
    if (!sizeof($forum_info)) {
        $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']);
        return;
    }
    $forum_info = $forum_info[$to_forum_id];
    if ($forum_info['forum_type'] != FORUM_POST) {
        $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']);
        return;
    }
    $redirect = request_var('redirect', build_url(array('quickmod')));
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'post_id_list' => $post_id_list, 'f' => $forum_id, 'mode' => 'topic_view', 'start' => $start, 'action' => $action, 't' => $topic_id, 'redirect' => $redirect, 'subject' => $subject, 'to_forum_id' => $to_forum_id, 'icon' => request_var('icon', 0)));
    $success_msg = $return_link = '';
    if (confirm_box(true)) {
        if ($action == 'split_beyond') {
            $sort_days = $total = 0;
            $sort_key = $sort_dir = '';
            $sort_by_sql = $sort_order_sql = array();
            phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
            $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
            if ($sort_order_sql[0] == 'u') {
                $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility
					FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u\n\t\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
            } else {
                $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility
					FROM ' . POSTS_TABLE . " p\n\t\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
            }
            $result = $db->sql_query_limit($sql, 0, $start);
            $store = false;
            $post_id_list = array();
            while ($row = $db->sql_fetchrow($result)) {
                // If split from selected post (split_beyond), we split the unapproved items too.
                if (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $row['forum_id'])) {
                    //					continue;
                }
                // Start to store post_ids as soon as we see the first post that was selected
                if ($row['post_id'] == $post_id) {
                    $store = true;
                }
                if ($store) {
                    $post_id_list[] = $row['post_id'];
                }
            }
            $db->sql_freeresult($result);
        }
        if (!sizeof($post_id_list)) {
            trigger_error('NO_POST_SELECTED');
        }
        $icon_id = request_var('icon', 0);
        $sql_ary = array('forum_id' => $to_forum_id, 'topic_title' => $subject, 'icon_id' => $icon_id, 'topic_visibility' => 1);
        $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
        $db->sql_query($sql);
        $to_topic_id = $db->sql_nextid();
        move_posts($post_id_list, $to_topic_id);
        $topic_info = phpbb_get_topic_data(array($topic_id));
        $topic_info = $topic_info[$topic_id];
        add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
        add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);
        // Change topic title of first post
        $sql = 'UPDATE ' . POSTS_TABLE . "\n\t\t\tSET post_subject = '" . $db->sql_escape($subject) . "'\n\t\t\tWHERE post_id = {$post_id_list[0]}";
        $db->sql_query($sql);
        // Copy topic subscriptions to new topic
        $sql = 'SELECT user_id, notify_status
			FROM ' . TOPICS_WATCH_TABLE . '
			WHERE topic_id = ' . $topic_id;
        $result = $db->sql_query($sql);
        $sql_ary = array();
//.........这里部分代码省略.........
开发者ID:mike-a-b,项目名称:crossfit,代码行数:101,代码来源:mcp_topic.php

示例4: move_topics

    /**
     * Moves topics to a new forum after they have been locked
     *
     * @param array $topic_data
     * @param string $action
     */
    public function move_topics($topic_data, $action)
    {
        $first_topic_data = reset($topic_data);
        $is_enabled = (int) $first_topic_data[$action];
        $to_forum_id = (int) $first_topic_data['move_topics_when_locked_to'];
        /**
         * This event allows you to perform additional actions before locked topics are moved.
         *
         * @event kasimi.movetopicswhenlocked.move_topics_before
         * @var	array	topic_data		Array with general topic data
         * @var	string	action			Who triggered the forums to be moved, one of move_topics_when_locked|move_topics_when_locked_solved
         * @var int		is_enabled		Whether or not the forum's ACP settings specify the topics to be moved
         * @var int		to_forum_id		The destination forum
         * @since 1.0.2
         */
        $vars = array('topic_data', 'action', 'is_enabled', 'to_forum_id');
        extract($this->dispatcher->trigger_event('kasimi.movetopicswhenlocked.move_topics_before', compact($vars)));
        // Forum settings are set to not move the topics
        if (!$is_enabled || !$to_forum_id) {
            return;
        }
        $forum_id = (int) $first_topic_data['forum_id'];
        // The topics are already in the destination forum
        if ($forum_id == $to_forum_id) {
            return;
        }
        if (!function_exists('phpbb_get_forum_data')) {
            include $this->root_path . 'includes/functions_mcp.' . $this->php_ext;
        }
        $to_forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
        // The destination forum does not exist
        if (empty($to_forum_data)) {
            return;
        }
        // The following code is taken from the mcp_move_topic() function in /includes/mpc/mcp_main.php
        $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0;
        $posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0;
        foreach ($topic_data as $topic_id => $topic_info) {
            if ($topic_info['topic_visibility'] == ITEM_APPROVED) {
                $topics_moved++;
            } else {
                if ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE) {
                    $topics_moved_unapproved++;
                } else {
                    if ($topic_info['topic_visibility'] == ITEM_DELETED) {
                        $topics_moved_softdeleted++;
                    }
                }
            }
            $posts_moved += $topic_info['topic_posts_approved'];
            $posts_moved_unapproved += $topic_info['topic_posts_unapproved'];
            $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted'];
        }
        $this->db->sql_transaction('begin');
        if (!function_exists('move_topics')) {
            include $this->root_path . 'includes/functions_admin.' . $this->php_ext;
        }
        // Move topics, but do not resync yet
        move_topics(array_keys($topic_data), $to_forum_id, false);
        foreach ($topic_data as $topic_id => $row) {
            // We add the $to_forum_id twice, because 'forum_id' is updated
            // when the topic is moved again later.
            $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'LOG_MOVED_LOCKED_TOPIC', false, array('forum_id' => (int) $to_forum_id, 'topic_id' => (int) $topic_id, $row['topic_title'], $row['forum_name'], $to_forum_data[$to_forum_id]['forum_name']));
        }
        $sync_sql = array();
        if ($posts_moved) {
            $sync_sql[$to_forum_id][] = 'forum_posts_approved = forum_posts_approved + ' . (int) $posts_moved;
            $sync_sql[$forum_id][] = 'forum_posts_approved = forum_posts_approved - ' . (int) $posts_moved;
        }
        if ($posts_moved_unapproved) {
            $sync_sql[$to_forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved + ' . (int) $posts_moved_unapproved;
            $sync_sql[$forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved - ' . (int) $posts_moved_unapproved;
        }
        if ($posts_moved_softdeleted) {
            $sync_sql[$to_forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted + ' . (int) $posts_moved_softdeleted;
            $sync_sql[$forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted - ' . (int) $posts_moved_softdeleted;
        }
        if ($topics_moved) {
            $sync_sql[$to_forum_id][] = 'forum_topics_approved = forum_topics_approved + ' . (int) $topics_moved;
            if ($topics_moved > 0) {
                $sync_sql[$forum_id][] = 'forum_topics_approved = forum_topics_approved - ' . (int) $topics_moved;
            }
        }
        if ($topics_moved_unapproved) {
            $sync_sql[$to_forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved + ' . (int) $topics_moved_unapproved;
            $sync_sql[$forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved - ' . (int) $topics_moved_unapproved;
        }
        if ($topics_moved_softdeleted) {
            $sync_sql[$to_forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted + ' . (int) $topics_moved_softdeleted;
            $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
        }
        foreach ($sync_sql as $forum_id_key => $array) {
            $sql = 'UPDATE ' . FORUMS_TABLE . '
				SET ' . implode(', ', $array) . '
//.........这里部分代码省略.........
开发者ID:kasimi,项目名称:phpbb-ext-movetopicswhenlocked,代码行数:101,代码来源:topic_mover.php

示例5: main


//.........这里部分代码省略.........
                if ($topic_id) {
                    $topic_info = phpbb_get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error('TOPIC_NOT_EXIST');
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list($m_perm, false, true);
                $forum_list_read = array_flip(get_forum_list('f_read', true, true));
                // Flipped so we can isset() the forum IDs
                // Remove forums we cannot read
                foreach ($forum_list_approve as $k => $forum_data) {
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_approve[$k]);
                    }
                }
                unset($forum_list_read);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!sizeof($forum_list)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_list);
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = phpbb_get_forum_data(array($forum_id), $m_perm);
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . truncate_string($row['forum_name'], 30, 255, false, $user->lang['ELLIPSIS']) . '</option>';
                }
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics_approved'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                $forum_names = array();
                if (!$is_topics) {
                    $sql = 'SELECT p.post_id
						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . '
						WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
							AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) . '
							' . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
							' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND (t.topic_visibility <> p.post_visibility\n\t\t\t\t\t\t\t\tOR t.topic_delete_user = 0)\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    /**
                     * Alter sql query to get posts in queue to be accepted
                     *
                     * @event core.mcp_queue_get_posts_query_before
                     * @var	string	sql						Associative array with the query to be executed
                     * @var	array	forum_list				List of forums that contain the posts
                     * @var	int		visibility_const		Integer with one of the possible ITEM_* constant values
                     * @var	int		topic_id				If topic_id not equal to 0, the topic id to filter the posts to display
开发者ID:ChALkeR,项目名称:phpbb,代码行数:67,代码来源:mcp_queue.php

示例6: mcp_lock_unlock_after

    /**
     * Event: core.mcp_lock_unlock_after
     */
    public function mcp_lock_unlock_after($event)
    {
        if ($event['action'] == 'lock') {
            $topic_ids = $event['ids'];
            $topic_id = (int) current($topic_ids);
            $topic_data = $event['data'];
            $forum_id = (int) $topic_data[$topic_id]['forum_id'];
            $to_forum_id = (int) $topic_data[$topic_id]['move_topics_to'];
            $forum_data = phpbb_get_forum_data($to_forum_id);
            $to_forum_name = $forum_data[$to_forum_id]['forum_name'];
            $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0;
            foreach ($topic_data as $topic_id => $topic_info) {
                if ($topic_info['topic_visibility'] == ITEM_APPROVED) {
                    $topics_moved++;
                } else {
                    if ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE) {
                        $topics_moved_unapproved++;
                    } else {
                        if ($topic_info['topic_visibility'] == ITEM_DELETED) {
                            $topics_moved_softdeleted++;
                        }
                    }
                }
            }
            $this->db->sql_transaction('begin');
            // Move topics, but do not resync yet
            if (!function_exists('move_topics')) {
                include $this->root_path . 'includes/functions_admin.' . $this->php_ext;
            }
            move_topics($topic_ids, $to_forum_id, false);
            foreach ($topic_data as $topic_id => $row) {
                // We add the $to_forum_id twice, because 'forum_id' is updated
                // when the topic is moved again later.
                $this->log->add('mod', $this->user->data['user_id'], $this->user->ip, 'LOG_MOVED_LOCKED_TOPIC', false, array('forum_id' => $to_forum_id, 'topic_id' => $topic_id, $row['topic_title'], $row['forum_name'], $to_forum_name));
            }
            unset($topic_data);
            $sync_sql = array();
            if ($topics_moved) {
                $sync_sql[$to_forum_id][] = 'forum_topics_approved = forum_topics_approved + ' . (int) $topics_moved;
                if ($topics_moved > 0) {
                    $sync_sql[$forum_id][] = 'forum_topics_approved = forum_topics_approved - ' . (int) $topics_moved;
                }
            }
            if ($topics_moved_unapproved) {
                $sync_sql[$to_forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved + ' . (int) $topics_moved_unapproved;
                $sync_sql[$forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved - ' . (int) $topics_moved_unapproved;
            }
            if ($topics_moved_softdeleted) {
                $sync_sql[$to_forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted + ' . (int) $topics_moved_softdeleted;
                $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
            }
            foreach ($sync_sql as $forum_id_key => $array) {
                $sql = 'UPDATE ' . FORUMS_TABLE . '
					SET ' . implode(', ', $array) . '
					WHERE forum_id = ' . $forum_id_key;
                $this->db->sql_query($sql);
            }
            $this->db->sql_transaction('commit');
            sync('forum', 'forum_id', array($forum_id, $to_forum_id));
        }
    }
开发者ID:phpbb-es,项目名称:phpbb-ext-movetopicswhenlocked,代码行数:64,代码来源:listener.php


注:本文中的phpbb_get_forum_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。