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


PHP get_forum_data函数代码示例

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


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

示例1: 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 (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) {
        return;
    }
    $post_id = $post_id_list[0];
    $post_info = 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 = 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();
            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_approved
					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_approved
					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_approved'] && !$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_approved' => 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 = 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);
        $success_msg = 'TOPIC_SPLIT_SUCCESS';
        // Update forum statistics
        set_config_count('num_topics', 1, true);
        // Link back to both topics
        $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<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>');
    } else {
//.........这里部分代码省略.........
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:101,代码来源:mcp_topic.php

示例2: forum_check_webtag_available

function forum_check_webtag_available(&$webtag = false)
{
    $result = forum_check_webtag_available_ignore();
    if (!($forum_data = get_forum_data())) {
        return $result;
    }
    if (!isset($forum_data['WEBTAG'])) {
        return $result;
    }
    if (isset($forum_data['DEFAULT_FORUM']) && $webtag === false) {
        $webtag = $forum_data['DEFAULT_FORUM'] == FORUM_DEFAULT ? $forum_data['WEBTAG'] : $webtag;
    }
    if ($forum_data['ACCESS_LEVEL'] != FORUM_DISABLED) {
        return true;
    }
    return $result;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:17,代码来源:forum.inc.php

示例3: main


//.........这里部分代码省略.........
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_reports[$k]);
                    }
                }
                unset($forum_list_read);
                if ($topic_id) {
                    $topic_info = 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) 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'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = 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);
                    $global_id = $forum_id;
                }
                $forum_list[] = 0;
                $forum_data = array();
                $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();
                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'] : $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}";
                $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
开发者ID:noprom,项目名称:cryptdb,代码行数:67,代码来源:mcp_reports.php

示例4: main

    function main($id, $mode)
    {
        global $auth, $db, $user, $template;
        global $config, $phpbb_root_path, $phpEx, $action;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'disapprove':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($action == 'approve') {
                    approve_post($post_id_list, $mode);
                } else {
                    disapprove_post($post_id_list, $mode);
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $user->add_lang('posting');
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                    } else {
                        $topic_id = 0;
                    }
                }
                $post_info = get_post_data(array($post_id), 'm_approve');
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                // Set some vars
                if ($post_info['user_id'] == ANONYMOUS) {
                    $poster = $post_info['post_username'] ? $post_info['post_username'] : $user->lang['GUEST'];
                }
                $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = smiley_text($message);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_PROFILE' => $post_info['user_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $post_info['user_id']) : '', 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start={$start}\">", '</a>'), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
                $this->tpl_name = 'mcp_post';
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $topic_id = request_var('t', 0);
                $forum_info = array();
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error($user->lang['TOPIC_NOT_EXIST']);
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list('m_approve', false, true);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!($forum_list = implode(', ', $forum_list))) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})";
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                    $global_id = $forum_list[0];
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                    $global_id = $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"' : '') . '>' . $row['forum_name'] . '</option>';
                }
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_queue.php

示例5: intval

 $recycle_check_freq = intval($HTTP_POST_VARS['recycle_check_freq']);
 $recycle_move_fid = intval($HTTP_POST_VARS['recycle_move_fid']);
 $prune_days = intval($HTTP_POST_VARS['prune_days']);
 $prune_freq = intval($HTTP_POST_VARS['prune_freq']);
 $forum_parent = $HTTP_POST_VARS['forum_parent'] != -1 ? intval($HTTP_POST_VARS['forum_parent']) : 0;
 $show_on_index = intval($HTTP_POST_VARS['show_on_index']);
 $forum_display_order = intval($HTTP_POST_VARS['forum_display_order']);
 $forum_display_sort = intval($HTTP_POST_VARS['forum_display_sort']);
 $forum_data = get_forum_data($forum_id);
 $old_cat_id = $forum_data['cat_id'];
 $forum_order = $forum_data['forum_order'];
 if (!$forum_name) {
     message_die(GENERAL_ERROR, "Can't modify a forum without a name");
 }
 if ($forum_parent) {
     if (!($parent = get_forum_data($forum_parent))) {
         message_die(GENERAL_ERROR, "Parent forum with <b>id={$forum_parent}</b> not found");
     }
     $cat_id = $parent['cat_id'];
     $forum_parent = $parent['forum_parent'] ? $parent['forum_parent'] : $parent['forum_id'];
     $forum_order = $parent['forum_order'] + 5;
     if ($forum_id == $forum_parent) {
         message_die(GENERAL_ERROR, "Ambiguous forum ID's. Please select other parent forum", '', __LINE__, __FILE__);
     }
 } else {
     if ($cat_id != $old_cat_id) {
         $max_order = get_max_cat_order($cat_id);
         $forum_order = $max_order + 5;
     }
 }
 $sql = 'UPDATE ' . FORUMS_TABLE . " SET\r\n\t\t\t\t\tforum_name = '{$forum_name}',\r\n\t\t\t\t\tcat_id = {$cat_id},\r\n\t\t\t\t\tforum_desc = '{$forum_desc}',\r\n\t\t\t\t\tforum_order = {$forum_order},\r\n\t\t\t\t\tforum_status = {$forum_status},\r\n\t\t\t\t\tprune_enable = {$prune_enable},\r\n\t\t\t\t\tmove_enable = {$move_enable},\r\n\t\t\t\t\tforum_parent = {$forum_parent},\r\n\t\t\t\t\tshow_on_index = {$show_on_index},\r\n\t\t\t\t\tforum_display_order = {$forum_display_order},\r\n\t\t\t\t\tforum_display_sort = {$forum_display_sort}\r\n\t\t\t\tWHERE forum_id = {$forum_id}";
开发者ID:forummaks,项目名称:forum_maks,代码行数:31,代码来源:admin_forums.php

示例6: main

 function main($id, $mode)
 {
     global $auth, $db, $user, $template, $action;
     global $config, $phpbb_root_path, $phpEx;
     $quickmod = $mode == 'quickmod' ? true : false;
     switch ($action) {
         case 'lock':
         case 'unlock':
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             lock_unlock($action, $topic_ids);
             break;
         case 'lock_post':
         case 'unlock_post':
             $post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             lock_unlock($action, $post_ids);
             break;
         case 'make_announce':
         case 'make_sticky':
         case 'make_global':
         case 'make_normal':
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             change_topic_type($action, $topic_ids);
             break;
         case 'move':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_move_topic($topic_ids);
             break;
         case 'fork':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_fork_topic($topic_ids);
             break;
         case 'delete_topic':
             $user->add_lang('viewtopic');
             $topic_ids = !$quickmod ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
             if (!sizeof($topic_ids)) {
                 trigger_error('NO_TOPIC_SELECTED');
             }
             mcp_delete_topic($topic_ids);
             break;
         case 'delete_post':
             $user->add_lang('posting');
             $post_ids = !$quickmod ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
             if (!sizeof($post_ids)) {
                 trigger_error('NO_POST_SELECTED');
             }
             mcp_delete_post($post_ids);
             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_var('f', 0);
             $forum_info = 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:
//.........这里部分代码省略.........
开发者ID:danielheyman,项目名称:EazySubs,代码行数:101,代码来源:mcp_main.php

示例7: mcp_queue

    function mcp_queue($id, $mode, $url)
    {
        global $_CLASS, $site_file_root, $config;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        switch ($mode) {
            case 'approve':
            case 'disapprove':
                require_once $site_file_root . 'includes/forums/functions_messenger.php';
                require_once $site_file_root . 'includes/forums/functions_posting.php';
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($mode == 'approve') {
                    approve_post($post_id_list);
                } else {
                    disapprove_post($post_id_list);
                }
                break;
            case 'approve_details':
                $_CLASS['core_user']->add_lang('posting');
                require_once $site_file_root . 'includes/forums/functions_posting.php';
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                }
                $post_info = get_post_data(array($post_id), 'm_approve');
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $_CLASS['core_template']->assign_array(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                // Set some vars
                $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    require_once $site_file_root . 'includes/forums/bbcode.php';
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = smiley_text($message);
                $_CLASS['core_template']->assign_array(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => generate_link("Forums&amp;file=mcp&amp;i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $_CLASS['auth']->acl_get('m_ip', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_WARNINGS' => $post_info['user_warnings'] ? true : false, 'U_VIEW_PROFILE' => generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $post_info['user_id']), 'U_MCP_USERNOTES' => generate_link('Forums&amp;file=mcp&amp;i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARNINGS' => generate_link('Forums&amp;file=mcp&amp;i=warnings&amp;mode=view_user&amp;u=' . $post_info['user_id']), 'U_EDIT' => $_CLASS['auth']->acl_get('m_edit', $post_info['forum_id']) ? generate_link("Forums&amp;file=posting&amp;mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', $_CLASS['core_user']->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $_CLASS['core_user']->img('icon_unapproved', $_CLASS['core_user']->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', $_CLASS['core_user']->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $_CLASS['core_user']->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
                $this->display($_CLASS['core_user']->lang['MCP_QUEUE'], 'mcp_post.html');
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $forum_info = array();
                $forum_list_approve = get_forum_list('m_approve', false, true);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!($forum_list = implode(', ', $forum_list))) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics 
						FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN ({$forum_list})";
                    $result = $_CLASS['core_db']->query($sql);
                    $row = $_CLASS['core_db']->fetch_row_assoc($result);
                    $_CLASS['core_db']->free_result($result);
                    $forum_info['forum_topics'] = (int) $row['sum_forum_topics'];
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    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"' : '') . '>' . $_CLASS['core_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"' : '') . '>' . $row['forum_name'] . '</option>';
                }
                mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                if ($mode == 'unapproved_posts') {
                    $sql = 'SELECT p.post_id
						FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . "\n\t\t\t\t\t\tWHERE p.forum_id IN ({$forum_list})\n\t\t\t\t\t\t\tAND p.post_approved = 0\n\t\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_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_first_post_id <> p.post_id\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $_CLASS['core_db']->query_limit($sql, $config['topics_per_page'], $start);
                    $i = 0;
                    $post_ids = array();
                    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $post_ids[] = $row['post_id'];
                        $row_num[$row['post_id']] = $i++;
                    }
                    if (sizeof($post_ids)) {
                        $sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, p.post_id, p.post_username, p.poster_id, p.post_time, u.username
							FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_FORUMS_TABLE . ' f, ' . FORUMS_TOPICS_TABLE . ' t, ' . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE p.post_id IN (" . implode(', ', $post_ids) . ")\n\t\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\t\tAND f.forum_id = p.forum_id\n\t\t\t\t\t\t\t\tAND u.user_id = p.poster_id";
                        $result = $_CLASS['core_db']->query($sql);
                        $post_data = $rowset = array();
                        while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                            $post_data[$row['post_id']] = $row;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:mcp_queue.php

示例8: get_table_prefix

function get_table_prefix()
{
    $forum_data = get_forum_data();
    if (is_array($forum_data) && isset($forum_data['WEBTAG'])) {
        return $forum_data;
    }
    return false;
}
开发者ID:bjork,项目名称:php-compat-info,代码行数:8,代码来源:source13873.php

示例9: split_topic

function split_topic($mode, $post_id_list, $topic_id, $to_forum_id, $subject)
{
    global $_CLASS;
    $start = request_var('start', 0);
    if (empty($post_id_list) || !check_ids($post_id_list, FORUMS_POSTS_TABLE, 'post_id', 'm_split')) {
        return false;
    }
    //$post_id = $post_id_list[0];
    $post_info = get_post_data($post_id_list);
    if (empty($post_info)) {
        return 'NO_POST_SELECTED';
    }
    $subject = trim($subject);
    if (!$subject) {
        return 'EMPTY_SUBJECT';
    }
    if ($to_forum_id <= 0) {
        return 'NO_DESTINATION_FORUM';
    }
    $forum_info = get_forum_data(array($to_forum_id), 'm_split');
    if (empty($forum_info)) {
        return 'NOT_MODERATOR_DESTINATION';
    }
    $forum_info = $forum_info[$to_forum_id];
    if ($forum_info['forum_type'] != FORUM_POST) {
        return 'DESTINATION_FORUM_NOT_POSTABLE';
    }
    $redirect = request_var('redirect', $_CLASS['core_user']->data['session_page']);
    $s_hidden_fields = build_hidden_fields(array('post_id_list' => $post_id_list, 'f' => $forum_id, 'mode' => 'topic_view', 'start' => $start, 'action' => $mode, '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)) {
        //$post_info = $post_info[$post_id];
        if ($mode == 'split_beyond') {
            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_approved
					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_approved
					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 = $_CLASS['core_db']->query_limit($sql, 0, $start);
            $store = false;
            $post_id_list = array();
            while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                // If splitted from selected post (split_beyond), we split the unapproved items too.
                if (!$row['post_approved'] && !$_CLASS['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'];
                }
            }
        }
        if (!sizeof($post_id_list)) {
            trigger_error($_CLASS['core_user']->lang['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_approved' => 1);
        $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $_CLASS['core_db']->sql_build_array('INSERT', $sql_ary);
        $_CLASS['core_db']->sql_query($sql);
        $to_topic_id = $_CLASS['core_db']->sql_nextid();
        move_posts($post_id_list, $to_topic_id);
        // Change topic title of first post
        $sql = 'UPDATE ' . POSTS_TABLE . " \n\t\t\tSET post_subject = '" . $_CLASS['core_db']->sql_escape($subject) . "'\n\t\t\tWHERE post_id = {$post_id_list[0]}";
        $_CLASS['core_db']->sql_query($sql);
        $success_msg = 'TOPIC_SPLIT_SUCCESS';
        // Link back to both topics
        $return_link = sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link('Forums&amp;file=viewtopic&amp;f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_NEW_TOPIC'], '<a href="' . generate_link('Forums&amp;file=viewtopic&amp;f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
    } else {
        confirm_box(false, $mode == 'split_all' ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields);
    }
    $redirect = request_var('redirect', generate_link('Forums'));
    /*if (strpos($redirect, '?') === false)
    	{
    		$redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1);
    	}*/
    if (!$success_msg) {
        return;
    } else {
        $_CLASS['core_display']->meta_refresh(3, generate_link("Forums&amp;file=viewtopic&amp;f={$to_forum_id}&amp;t={$to_topic_id}"));
        trigger_error($_CLASS['core_user']->lang[$success_msg] . '<br /><br />' . $return_link);
    }
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:89,代码来源:mcp_topic.php

示例10: get_variable

//
// $Id: mcp_forum.php,v 1.3 2004/07/19 20:13:16 acydburn Exp $
//
// FILENAME  : mcp_forum.php
// STARTED   : Thu Jul 08, 2004
// COPYRIGHT : 2004 phpBB Group
// WWW       : http://www.phpbb.com/
// LICENCE   : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
$forum_id = get_variable('f', 'REQUEST', false, 'int');
if (!$forum_id || !$_CLASS['auth']->acl_get('m_', $forum_id)) {
    trigger_error('MODULE_NOT_EXIST');
}
$_CLASS['core_user']->add_lang('viewforum');
$forum_info = get_forum_data($forum_id, 'm_');
if (empty($forum_info[$forum_id])) {
    exit;
}
$forum_info = $forum_info[$forum_id];
$url = 'Forums&amp;file=mcp&amp;f=' . $forum_id;
$action = get_variable('action', 'REQUEST');
if ($action === 'merge_select') {
    // Fixes a "bug" that makes forum_view use the same ordering as topic_view
    unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']);
}
$start = get_variable('start', 'REQUEST', false, 'int');
$topic_id_list = array_unique(request_var('topic_id_list', array(0)));
$post_id_list = array_unique(request_var('post_id_list', array(0)));
$topic_id = get_variable('t', 'REQUEST', false, 'int');
// Resync Topics
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:mcp_forum.php

示例11: array

        if (!$forum_id) {
            $forum_list = array();
            foreach ($forum_list_approve as $row) {
                $forum_list[] = $row['forum_id'];
            }
            if (!($forum_list = implode(', ', $forum_list))) {
                trigger_error('NOT_MODERATOR');
            }
            $sql = 'SELECT SUM(forum_topics) as sum_forum_topics 
				FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\tWHERE forum_id IN ({$forum_list})";
            $result = $_CLASS['core_db']->query($sql);
            $row = $_CLASS['core_db']->fetch_row_assoc($result);
            $_CLASS['core_db']->free_result($result);
            $forum_info['forum_topics'] = (int) $row['sum_forum_topics'];
        } else {
            $forum_info = get_forum_data(array($forum_id), 'm_approve');
            if (empty($forum_info[$forum_id])) {
                trigger_error('NOT_MODERATOR');
            }
            $forum_info = $forum_info[$forum_id];
            $forum_list = $forum_id;
        }
        $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $_CLASS['core_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"' : '') . '>' . $row['forum_name'] . '</option>';
        }
        mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
        $forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
        $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . ($_CLASS['core_user']->time - $sort_days * 86400) : '';
        if ($mode === 'unapproved_posts') {
            $sql = 'SELECT DISTINCT p.post_id
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:mcp_queue.php

示例12: mcp_fork_topic

function mcp_fork_topic($topic_ids)
{
    global $_CLASS, $config;
    if (!check_ids($topic_ids, FORUMS_TOPICS_TABLE, 'topic_id', 'm_')) {
        return;
    }
    $redirect = get_variable('redirect', 'POST', $_CLASS['core_user']->data['session_url']);
    $to_forum_id = get_variable('to_forum_id', 'POST', 0, 'int');
    $additional_msg = $success_msg = '';
    if ($to_forum_id) {
        $forum_data = get_forum_data($to_forum_id, 'm_');
        if (empty($forum_data[$to_forum_id])) {
            $additional_msg = $_CLASS['core_user']->lang['FORUM_NOT_EXIST'];
        } else {
            $forum_data = $forum_data[$to_forum_id];
            if ($forum_data['forum_type'] != FORUM_POST) {
                $additional_msg = $_CLASS['core_user']->lang['FORUM_NOT_POSTABLE'];
            } elseif (!$_CLASS['auth']->acl_get('f_post', $to_forum_id)) {
                $additional_msg = $_CLASS['core_user']->lang['USER_CANNOT_POST'];
            }
        }
    }
    if (!$to_forum_id || $additional_msg) {
        unset($_POST['confirm']);
    }
    $hidden_fields = generate_hidden_fields(array('topic_id_list' => $topic_ids, 'mode' => 'fork', 'redirect' => $redirect));
    $_CLASS['core_template']->assign_array(array('S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true), 'S_CAN_LEAVE_SHADOW' => false, 'ADDITIONAL_MSG' => $additional_msg));
    $message = $_CLASS['core_user']->get_lang('FORK_TOPIC' . (count($topic_ids) === 1 ? '' : 'S'));
    page_header();
    if (display_confirmation($message, $hidden_fields, 'modules/Forums/mcp_move.html')) {
        $topic_data = get_topic_data($topic_ids);
        $total_posts = 0;
        $new_topic_id_list = $new_topic_forum_name_list = $insert_array = array();
        $_CLASS['core_db']->transaction();
        foreach ($topic_data as $topic_id => $topic_row) {
            // just change $row values for forum_id, topic_reported;
            // get_topic_data gets some unneeded stuff, remove it so we can just use $row
            $sql_ary = array('forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], 'topic_approved' => 1, '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_replies' => (int) $topic_row['topic_replies_real'], 'topic_replies_real' => (int) $topic_row['topic_replies_real'], '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'], 'topic_views' => 0, 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], 'poll_length' => (int) $topic_row['poll_length']);
            $_CLASS['core_db']->sql_query_build('INSERT', $sql_ary, FORUMS_TOPICS_TABLE);
            unset($sql_ary);
            $new_topic_id = $_CLASS['core_db']->insert_id(FORUMS_TOPICS_TABLE, 'topic_id');
            $new_topic_id_list[$topic_id] = $new_topic_id;
            $new_topic_forum_name_list[$topic_id] = $topic_row['forum_name'];
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT * 
					FROM ' . FORUMS_POLL_OPTIONS_TABLE . " \n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $_CLASS['core_db']->query($sql);
                while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                    $insert_array[FORUMS_POLL_OPTIONS_TABLE][] = 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);
                }
                $_CLASS['core_db']->free_result($result);
            }
            unset($topic_data[$topic_id]);
            $sql = 'SELECT *
				FROM ' . FORUMS_POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_id ASC";
            $result = $_CLASS['core_db']->query($sql);
            while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                $total_posts++;
                $insert_array[FORUMS_POSTS_TABLE][] = array('topic_id' => (int) $new_topic_id, 'forum_id' => (int) $to_forum_id, 'poster_id' => (int) $row['poster_id'], 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], 'post_approved' => 1, 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_html' => (int) $row['enable_html'], 'enable_smilies' => (int) $row['enable_smilies'], 'enable_magic_url' => (int) $row['enable_magic_url'], 'enable_sig' => (int) $row['enable_sig'], 'post_username' => (string) $row['post_username'], 'post_subject' => (string) $row['post_subject'], 'post_text' => (string) $row['post_text'], 'post_edit_reason' => (string) $row['post_edit_reason'], 'post_edit_user' => (int) $row['post_edit_user'], 'post_checksum' => (string) $row['post_checksum'], 'post_attachment' => (int) $row['post_attachment'], 'bbcode_bitfield' => (int) $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked']);
                // Copy Attachments
                if ($row['post_attachment']) {
                    $_CLASS['core_db']->query('INSERT INTO ' . FORUMS_POSTS_TABLE . ' ' . $_CLASS['core_db']->sql_build_array('INSERT', array_pop($insert_array[FORUMS_POSTS_TABLE])));
                    $new_post_id = $_CLASS['core_db']->insert_id(FORUMS_POSTS_TABLE, 'post_id');
                    $sql = 'SELECT * FROM ' . FORUMS_ATTACHMENTS_TABLE . "\n\t\t\t\t\t\tWHERE post_msg_id = {$row['post_id']}\n\t\t\t\t\t\t\tAND topic_id = {$topic_id}\n\t\t\t\t\t\t\tAND in_message = 0";
                    $result = $_CLASS['core_db']->query($sql);
                    while ($attach_row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $insert_array[FORUMS_ATTACHMENTS_TABLE][] = array('post_msg_id' => (int) $new_post_id, 'topic_id' => (int) $new_topic_id, 'in_message' => 0, 'poster_id' => (int) $attach_row['poster_id'], 'physical_filename' => (string) basename($attach_row['physical_filename']), 'real_filename' => (string) basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'attach_comment' => (string) $attach_row['attach_comment'], 'extension' => (string) $attach_row['extension'], 'mimetype' => (string) $attach_row['mimetype'], 'filesize' => (int) $attach_row['filesize'], 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail']);
                    }
                    $_CLASS['core_db']->free_result($result);
                }
            }
            $_CLASS['core_db']->free_result($result);
        }
        unset($topic_data);
        $_CLASS['core_db']->transaction('commit');
        if (!empty($new_topic_id_list)) {
            if (!empty($insert_array[FORUMS_POLL_OPTIONS_TABLE])) {
                $_CLASS['core_db']->sql_query_build('MULTI_INSERT', $insert_array[FORUMS_POLL_OPTIONS_TABLE], FORUMS_POLL_OPTIONS_TABLE);
            }
            if (!empty($insert_array[FORUMS_POSTS_TABLE])) {
                $_CLASS['core_db']->sql_query_build('MULTI_INSERT', $insert_array[FORUMS_POSTS_TABLE], FORUMS_POSTS_TABLE);
            }
            if (!empty($insert_array[FORUMS_ATTACHMENTS_TABLE])) {
                $_CLASS['core_db']->sql_query_build('MULTI_INSERT', $insert_array[FORUMS_ATTACHMENTS_TABLE], FORUMS_ATTACHMENTS_TABLE);
            }
            unset($insert_array);
            // Sync new topics, parent forums and board stats
            sync('topic', 'topic_id', $new_topic_id_list, true);
            sync('forum', 'forum_id', $to_forum_id, true);
            set_config('num_topics', $config['num_topics'] + count($new_topic_id_list));
            set_config('num_posts', $config['num_posts'] + $total_posts);
            foreach ($new_topic_id_list as $topic_id => $new_topic_id) {
                add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $new_topic_forum_name_list[$topic_id]['forum_name']);
            }
            $success_msg = count($topic_ids) === 1 ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
        }
    }
    $redirect = generate_link($redirect);
    if (!$success_msg) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:mcp_main.php

示例13: main


//.........这里部分代码省略.........

					$topic_info = $topic_info[$topic_id];
					$forum_id = $topic_info['forum_id'];
				}

				$forum_list_approve = get_forum_list('m_approve', false, true);

				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');
					}

					$global_id = $forum_list[0];

					$forum_list = implode(', ', $forum_list);

					$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . "
						WHERE forum_id IN (0, $forum_list)";
					$result = $db->sql_query($sql);
					$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
					$db->sql_freeresult($result);
				}
				else
				{
					$forum_info = get_forum_data(array($forum_id), 'm_approve');

					if (!sizeof($forum_info))
					{
						trigger_error('NOT_MODERATOR');
					}

					$forum_info = $forum_info[$forum_id];
					$forum_list = $forum_id;
					$global_id = $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']) . $row['forum_name'] . '</option>';
				}

				$sort_days = $total = 0;
				$sort_key = $sort_dir = '';
				$sort_by_sql = $sort_order_sql = array();
				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'] : $total;
				$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';

				$forum_names = array();

				if ($mode == 'unapproved_posts')
				{
					$sql = 'SELECT p.post_id
						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
						WHERE p.forum_id IN (0, $forum_list)
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:mcp_queue.php

示例14: split_topic

function split_topic($action, $post_id_list, $topic_id, $to_forum_id, $subject)
{
    global $_CLASS;
    $start = get_variable('start', 'REQUEST', false, 'int');
    if (empty($post_id_list) || !check_ids($post_id_list, FORUMS_POSTS_TABLE, 'post_id', 'm_split')) {
        return 'NO_POST_SELECTED';
    }
    $post_id = $post_id_list[0];
    $post_info = get_post_data(array($post_id));
    if (empty($post_info)) {
        return 'NO_POST_SELECTED';
    }
    $post_info = $post_info[$post_id];
    $subject = trim($subject);
    if (!$subject) {
        return 'EMPTY_SUBJECT';
    }
    if ($to_forum_id <= 0) {
        return 'NO_DESTINATION_FORUM';
    }
    $forum_info = get_forum_data(array($to_forum_id), 'm_split');
    if (empty($forum_info[$to_forum_id])) {
        return 'NOT_MODERATOR_DESTINATION';
    }
    $forum_info = $forum_info[$to_forum_id];
    if ($forum_info['forum_type'] != FORUM_POST) {
        return 'DESTINATION_FORUM_NOT_POSTABLE';
    }
    $redirect = get_variable('redirect', 'POST', $_CLASS['core_user']->data['session_url']);
    $hidden_fields = build_hidden_fields(array('post_id_list' => $post_id_list, 'mode' => 'topic_view', 'start' => $start, 'action' => $action, 't' => $topic_id, 'redirect' => $redirect, 'subject' => $subject, 'to_forum_id' => $to_forum_id, 'icon' => get_variable('icon', 'REQUEST', false, 'int')));
    $message = $action === 'split_all' ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND';
    if (display_confirmation($_CLASS['core_user']->get_lang($message), $hidden_fields)) {
        if ($action === 'split_beyond') {
            mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $post_info['forum_id'], $topic_id);
            $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . ($_CLASS['core_user']->time - $sort_days * 86400) : '';
            if ($sort_order_sql[0] == 'u') {
                $sql = 'SELECT p.post_id
					FROM ' . FORUMS_POSTS_TABLE . ' p, ' . CORE_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
					FROM ' . FORUMS_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 = $_CLASS['core_db']->query_limit($sql, 0, $start);
            $store = false;
            $post_id_list = array();
            while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                // 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'];
                }
            }
            $_CLASS['core_db']->free_result($result);
        }
        if (empty($post_id_list)) {
            trigger_error('NO_POST_SELECTED');
        }
        $icon_id = get_variable('icon', 'REQUEST', 0, 'int');
        $_CLASS['core_db']->transaction();
        $sql_ary = array('forum_id' => $to_forum_id, 'topic_title' => $subject, 'icon_id' => $icon_id, 'topic_approved' => 1, 'topic_poster' => $post_info['poster_id'], 'topic_first_poster_name' => $post_info['post_username'], 'topic_time' => $_CLASS['core_user']->time, 'topic_status' => ITEM_UNLOCKED, 'topic_type' => POST_NORMAL, 'topic_attachment' => 0, 'topic_replies_real' => 0, 'topic_replies' => 0, 'topic_views' => 0, 'topic_moved_id' => 0);
        $_CLASS['core_db']->query('INSERT INTO ' . FORUMS_TOPICS_TABLE . ' ' . $_CLASS['core_db']->sql_build_array('INSERT', $sql_ary));
        $to_topic_id = $_CLASS['core_db']->insert_id(FORUMS_TOPICS_TABLE, 'topic_id');
        move_posts($post_id_list, $to_topic_id);
        // Change topic title of first post
        $sql = 'UPDATE ' . FORUMS_POSTS_TABLE . " \n\t\t\tSET post_subject = '" . $_CLASS['core_db']->escape($subject) . "'\n\t\t\tWHERE post_id = {$post_id_list[0]}";
        $_CLASS['core_db']->query($sql);
        $_CLASS['core_db']->transaction('commit');
        $success_msg = 'TOPIC_SPLIT_SUCCESS';
        // Link back to both topics
        $return_link = sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link('Forums&amp;file=viewtopic&amp;f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_NEW_TOPIC'], '<a href="' . generate_link('Forums&amp;file=viewtopic&amp;f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
    }
    $redirect = generate_link($redirect);
    if (!$success_msg) {
        return;
    } else {
        $_CLASS['core_display']->meta_refresh(3, generate_link("Forums&amp;file=viewtopic&amp;f={$to_forum_id}&amp;t={$to_topic_id}"));
        trigger_error($_CLASS['core_user']->lang[$success_msg] . '<br /><br />' . $return_link);
    }
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:81,代码来源:mcp_topic.php


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