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


PHP phpbb_check_ids函数代码示例

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


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

示例1: close_report

/**
* Closes a report
*/
function close_report($report_id_list, $mode, $action, $pm = false)
{
    global $db, $template, $user, $config, $auth;
    global $phpEx, $phpbb_root_path, $phpbb_container;
    $pm_where = $pm ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
    $id_column = $pm ? 'pm_id' : 'post_id';
    $module = $pm ? 'pm_reports' : 'reports';
    $pm_prefix = $pm ? 'PM_' : '';
    $sql = "SELECT r.{$id_column}\n\t\tFROM " . REPORTS_TABLE . ' r
		WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where;
    $result = $db->sql_query($sql);
    $post_id_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $post_id_list[] = $row[$id_column];
    }
    $post_id_list = array_unique($post_id_list);
    if ($pm) {
        if (!$auth->acl_getf_global('m_report')) {
            trigger_error('NOT_AUTHORISED');
        }
    } else {
        if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) {
            trigger_error('NOT_AUTHORISED');
        }
    }
    if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) {
        $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports');
    } else {
        if ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false) {
            $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports');
        } else {
            if ($action == 'close' && !request_var('r', 0)) {
                $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module);
            } else {
                $redirect = request_var('redirect', build_url(array('quickmod')));
            }
        }
    }
    $success_msg = '';
    $forum_ids = array();
    $topic_ids = array();
    $s_hidden_fields = build_hidden_fields(array('i' => $module, 'mode' => $mode, 'report_id_list' => $report_id_list, 'action' => $action, 'redirect' => $redirect));
    if (confirm_box(true)) {
        $post_info = $pm ? phpbb_get_pm_data($post_id_list) : phpbb_get_post_data($post_id_list, 'm_report');
        $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\n\t\t\tFROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
			WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . '
				' . ($action == 'close' ? 'AND r.report_closed = 0' : '') . '
				AND r.user_id = u.user_id' . $pm_where;
        $result = $db->sql_query($sql);
        $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array();
        while ($report = $db->sql_fetchrow($result)) {
            $reports[$report['report_id']] = $report;
            $report_id_list[] = $report['report_id'];
            if (!$report['report_closed']) {
                $close_report_posts[] = $report[$id_column];
                if (!$pm) {
                    $close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
                }
            }
            if ($report['user_notify'] && !$report['report_closed']) {
                $notify_reporters[$report['report_id']] =& $reports[$report['report_id']];
            }
        }
        $db->sql_freeresult($result);
        if (sizeof($reports)) {
            $close_report_posts = array_unique($close_report_posts);
            $close_report_topics = array_unique($close_report_topics);
            if (!$pm && sizeof($close_report_posts)) {
                // Get a list of topics that still contain reported posts
                $sql = 'SELECT DISTINCT topic_id
					FROM ' . POSTS_TABLE . '
					WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
						AND post_reported = 1
						AND ' . $db->sql_in_set('post_id', $close_report_posts, true);
                $result = $db->sql_query($sql);
                $keep_report_topics = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $keep_report_topics[] = $row['topic_id'];
                }
                $db->sql_freeresult($result);
                $close_report_topics = array_diff($close_report_topics, $keep_report_topics);
                unset($keep_report_topics);
            }
            $db->sql_transaction('begin');
            if ($action == 'close') {
                $sql = 'UPDATE ' . REPORTS_TABLE . '
					SET report_closed = 1
					WHERE ' . $db->sql_in_set('report_id', $report_id_list);
            } else {
                $sql = 'DELETE FROM ' . REPORTS_TABLE . '
					WHERE ' . $db->sql_in_set('report_id', $report_id_list);
            }
            $db->sql_query($sql);
            if (sizeof($close_report_posts)) {
                if ($pm) {
                    $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
						SET message_reported = 0
//.........这里部分代码省略.........
开发者ID:Voxel37,项目名称:phpbb,代码行数:101,代码来源:mcp_reports.php

示例2: merge_topics

/**
* Merge selected topics into selected topic
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request;
    if (!sizeof($topic_ids)) {
        $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
        return;
    }
    if (!$to_topic_id) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_topics = array_merge($topic_ids, array($to_topic_id));
    $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
    if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_forums = array();
    foreach ($topic_data as $data) {
        $sync_forums[$data['forum_id']] = $data['forum_id'];
    }
    $topic_data = $topic_data[$to_topic_id];
    $post_id_list = $request->variable('post_id_list', array(0));
    $start = $request->variable('start', 0);
    if (!sizeof($post_id_list) && sizeof($topic_ids)) {
        $sql = 'SELECT post_id
			FROM ' . POSTS_TABLE . '
			WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
        $result = $db->sql_query($sql);
        $post_id_list = array();
        while ($row = $db->sql_fetchrow($result)) {
            $post_id_list[] = $row['post_id'];
        }
        $db->sql_freeresult($result);
    }
    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_merge'))) {
        return;
    }
    $redirect = $request->variable('redirect', build_url(array('quickmod')));
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'f' => $forum_id, 'post_id_list' => $post_id_list, 'to_topic_id' => $to_topic_id, 'mode' => 'forum_view', 'action' => 'merge_topics', 'start' => $start, 'redirect' => $redirect, 'topic_id_list' => $topic_ids));
    $return_link = '';
    if (confirm_box(true)) {
        $to_forum_id = $topic_data['forum_id'];
        move_posts($post_id_list, $to_topic_id, false);
        $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array('forum_id' => $to_forum_id, 'topic_id' => $to_topic_id, $topic_data['topic_title']));
        // Message and return links
        $success_msg = 'POSTS_MERGED_SUCCESS';
        if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status')) {
            include $phpbb_root_path . 'includes/functions_database_helper.' . $phpEx;
        }
        // Update the topic watch table.
        phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Update the bookmarks table.
        phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Re-sync the topics and forums because the auto-sync was deactivated in the call of  move_posts()
        sync('topic_reported', 'topic_id', $sync_topics);
        sync('topic_attachment', 'topic_id', $sync_topics);
        sync('topic', 'topic_id', $sync_topics, true);
        sync('forum', 'forum_id', $sync_forums, true, true);
        // Link to the new topic
        $return_link .= ($return_link ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
        $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.{$phpEx}?f={$to_forum_id}&amp;t={$to_topic_id}");
        $redirect = reapply_sid($redirect);
        meta_refresh(3, $redirect);
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    } else {
        confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
    }
}
开发者ID:bruninoit,项目名称:phpbb,代码行数:76,代码来源:mcp_forum.php

示例3: mcp_fork_topic

/**
* Fork Topic
*/
function mcp_fork_topic($topic_ids)
{
    global $auth, $user, $db, $template, $config;
    global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
    if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) {
        return;
    }
    $to_forum_id = $request->variable('to_forum_id', 0);
    $forum_id = $request->variable('f', 0);
    $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
    $additional_msg = $success_msg = '';
    $counter = array();
    $s_hidden_fields = build_hidden_fields(array('topic_id_list' => $topic_ids, 'f' => $forum_id, 'action' => 'fork', 'redirect' => $redirect));
    if ($to_forum_id) {
        $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
        if (!sizeof($topic_ids)) {
            $additional_msg = $user->lang['NO_TOPIC_SELECTED'];
        } else {
            if (!sizeof($forum_data)) {
                $additional_msg = $user->lang['FORUM_NOT_EXIST'];
            } else {
                $forum_data = $forum_data[$to_forum_id];
                if ($forum_data['forum_type'] != FORUM_POST) {
                    $additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
                } else {
                    if (!$auth->acl_get('f_post', $to_forum_id)) {
                        $additional_msg = $user->lang['USER_CANNOT_POST'];
                    }
                }
            }
        }
    } else {
        if (isset($_POST['confirm'])) {
            $additional_msg = $user->lang['FORUM_NOT_EXIST'];
        }
    }
    if ($additional_msg) {
        $request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
        $request->overwrite('confirm_key', null);
    }
    if (confirm_box(true)) {
        $topic_data = phpbb_get_topic_data($topic_ids, 'f_post');
        $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0;
        $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0;
        $new_topic_id_list = array();
        foreach ($topic_data as $topic_id => $topic_row) {
            if (!isset($search_type) && $topic_row['enable_indexing']) {
                // Select the search method and do some additional checks to ensure it can actually be utilised
                $search_type = $config['search_type'];
                if (!class_exists($search_type)) {
                    trigger_error('NO_SUCH_SEARCH_MODULE');
                }
                $error = false;
                $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
                $search_mode = 'post';
                if ($error) {
                    trigger_error($error);
                }
            } else {
                if (!isset($search_type) && !$topic_row['enable_indexing']) {
                    $search_type = false;
                }
            }
            $sql_ary = array('forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], 'topic_visibility' => (int) $topic_row['topic_visibility'], 'topic_reported' => 0, 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], 'topic_time' => (int) $topic_row['topic_time'], 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'], 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], 'topic_status' => (int) $topic_row['topic_status'], 'topic_type' => (int) $topic_row['topic_type'], 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], 'topic_bumped' => (int) $topic_row['topic_bumped'], 'topic_bumper' => (int) $topic_row['topic_bumper'], 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], 'poll_length' => (int) $topic_row['poll_length'], 'poll_max_options' => (int) $topic_row['poll_max_options'], 'poll_vote_change' => (int) $topic_row['poll_vote_change']);
            $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            $new_topic_id = $db->sql_nextid();
            $new_topic_id_list[$topic_id] = $new_topic_id;
            switch ($topic_row['topic_visibility']) {
                case ITEM_APPROVED:
                    $total_topics++;
                    break;
                case ITEM_UNAPPROVED:
                case ITEM_REAPPROVE:
                    $total_topics_unapproved++;
                    break;
                case ITEM_DELETED:
                    $total_topics_softdeleted++;
                    break;
            }
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT *
					FROM ' . POLL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('poll_option_id' => (int) $row['poll_option_id'], 'topic_id' => (int) $new_topic_id, 'poll_option_text' => (string) $row['poll_option_text'], 'poll_option_total' => 0);
                    $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                }
                $db->sql_freeresult($result);
            }
            $sql = 'SELECT *
				FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_time ASC, post_id ASC";
            $result = $db->sql_query($sql);
            $post_rows = array();
            while ($row = $db->sql_fetchrow($result)) {
                $post_rows[] = $row;
            }
//.........这里部分代码省略.........
开发者ID:tqangxl,项目名称:phpbb,代码行数:101,代码来源:mcp_main.php

示例4: disapprove_posts

    /**
     * Disapprove Post
     *
     * @param $post_id_list	array	IDs of the posts to disapprove/delete
     * @param $id			mixed	Category of the current active module
     * @param $mode			string	Active module
     * @return null
     */
    public static function disapprove_posts($post_id_list, $id, $mode)
    {
        global $db, $template, $user, $config, $phpbb_container, $phpbb_dispatcher;
        global $phpEx, $phpbb_root_path, $request, $phpbb_log;
        if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) {
            trigger_error('NOT_AUTHORISED');
        }
        $redirect = $request->variable('redirect', build_url(array('t', 'mode', 'quickmod')) . "&amp;mode={$mode}");
        $redirect = reapply_sid($redirect);
        $reason = $request->variable('reason', '', true);
        $reason_id = $request->variable('reason_id', 0);
        $success_msg = $additional_msg = '';
        $s_hidden_fields = build_hidden_fields(array('i' => $id, 'mode' => $mode, 'post_id_list' => $post_id_list, 'action' => 'disapprove', 'redirect' => $redirect));
        $notify_poster = $request->is_set('notify_poster');
        $disapprove_reason = '';
        if ($reason_id) {
            $sql = 'SELECT reason_title, reason_description
				FROM ' . REPORTS_REASONS_TABLE . "\n\t\t\t\tWHERE reason_id = {$reason_id}";
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row || !$reason && strtolower($row['reason_title']) == 'other') {
                $additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
                $request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
                $request->overwrite('confirm_key', null, \phpbb\request\request_interface::POST);
                $request->overwrite('confirm_key', null, \phpbb\request\request_interface::REQUEST);
            } else {
                // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
                $disapprove_reason = strtolower($row['reason_title']) != 'other' ? isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description'] : '';
                $disapprove_reason .= $reason ? "\n\n" . $reason : '';
                if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) {
                    $disapprove_reason_lang = strtoupper($row['reason_title']);
                }
            }
        }
        $post_info = phpbb_get_post_data($post_id_list, 'm_approve');
        $is_disapproving = false;
        foreach ($post_info as $post_id => $post_data) {
            if ($post_data['post_visibility'] == ITEM_DELETED) {
                continue;
            }
            $is_disapproving = true;
        }
        if (confirm_box(true)) {
            $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
            $topic_posts_unapproved = $post_disapprove_list = $topic_information = array();
            // Build a list of posts to be disapproved and get the related topics real replies count
            foreach ($post_info as $post_id => $post_data) {
                $post_disapprove_list[$post_id] = $post_data['topic_id'];
                if (!isset($topic_posts_unapproved[$post_data['topic_id']])) {
                    $topic_information[$post_data['topic_id']] = $post_data;
                    $topic_posts_unapproved[$post_data['topic_id']] = 0;
                }
                $topic_posts_unapproved[$post_data['topic_id']]++;
            }
            // Now we build the log array
            foreach ($post_disapprove_list as $post_id => $topic_id) {
                // If the count of disapproved posts for the topic is equal
                // to the number of unapproved posts in the topic, and there are no different
                // posts, we disapprove the hole topic
                if ($topic_information[$topic_id]['topic_posts_approved'] == 0 && $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 && $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id]) {
                    // Don't write the log more than once for every topic
                    if (!isset($disapprove_log_topics[$topic_id])) {
                        // Build disapproved topics log
                        $disapprove_log_topics[$topic_id] = array('type' => 'topic', 'post_subject' => $post_info[$post_id]['topic_title'], 'forum_id' => $post_info[$post_id]['forum_id'], 'topic_id' => 0, 'post_username' => $post_info[$post_id]['poster_id'] == ANONYMOUS && !empty($post_info[$post_id]['post_username']) ? $post_info[$post_id]['post_username'] : $post_info[$post_id]['username']);
                    }
                } else {
                    // Build disapproved posts log
                    $disapprove_log_posts[] = array('type' => 'post', 'post_subject' => $post_info[$post_id]['post_subject'], 'forum_id' => $post_info[$post_id]['forum_id'], 'topic_id' => $post_info[$post_id]['topic_id'], 'post_username' => $post_info[$post_id]['poster_id'] == ANONYMOUS && !empty($post_info[$post_id]['post_username']) ? $post_info[$post_id]['post_username'] : $post_info[$post_id]['username']);
                }
            }
            // Get disapproved posts/topics counts separately
            $num_disapproved_topics = sizeof($disapprove_log_topics);
            $num_disapproved_posts = sizeof($disapprove_log_posts);
            // Build the whole log
            $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
            // Unset unneeded arrays
            unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
            // Let's do the job - delete disapproved posts
            if (sizeof($post_disapprove_list)) {
                if (!function_exists('delete_posts')) {
                    include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
                }
                // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
                // Note: function delete_posts triggers related forums/topics sync,
                // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually
                delete_posts('post_id', array_keys($post_disapprove_list));
                foreach ($disapprove_log as $log_data) {
                    if ($is_disapproving) {
                        $l_log_message = $log_data['type'] == 'topic' ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED';
                        $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array('forum_id' => $log_data['forum_id'], 'topic_id' => $log_data['topic_id'], $log_data['post_subject'], $disapprove_reason, $log_data['post_username']));
                    } else {
//.........这里部分代码省略.........
开发者ID:ChALkeR,项目名称:phpbb,代码行数:101,代码来源:mcp_queue.php


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