Пример #1
0
function SplitExecute()
{
    global $txt, $board, $topic, $db_prefix, $context, $ID_MEMBER, $user_info;
    // They blanked the subject name.
    if (!isset($_POST['subname']) || $_POST['subname'] == '') {
        $_POST['subname'] = $txt['smf258'];
    }
    // Redirect to the selector if they chose selective.
    if ($_POST['step2'] == 'selective') {
        $_REQUEST['subname'] = $_POST['subname'];
        return SplitSelectTopics();
    }
    // Check the session to make sure they meant to do this.
    checkSession();
    $_POST['at'] = (int) $_POST['at'];
    $messagesToBeSplit = array();
    if ($_POST['step2'] == 'afterthis') {
        // Fetch the message IDs of the topic that are at or after the message.
        $request = db_query("\n\t\t\tSELECT ID_MSG\n\t\t\tFROM {$db_prefix}messages\n\t\t\tWHERE ID_TOPIC = {$topic}\n\t\t\t\tAND ID_MSG >= {$_POST['at']}", __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($request)) {
            $messagesToBeSplit[] = $row['ID_MSG'];
        }
        mysql_free_result($request);
    } elseif ($_POST['step2'] == 'onlythis') {
        $messagesToBeSplit[] = $_POST['at'];
    } else {
        fatal_lang_error(1, false);
    }
    $context['old_topic'] = $topic;
    $context['new_topic'] = splitTopic($topic, $messagesToBeSplit, $_POST['subname']);
    $context['page_title'] = $txt['smf251'];
}
Пример #2
0
/**
 * do the actual split.
 * is accessed with ?action=splittopics;sa=execute.
 * uses the main SplitTopics template.
 * supports three ways of splitting:
 * (1) only one message is split off.
 * (2) all messages after and including a given message are split off.
 * (3) select topics to split (redirects to SplitSelectTopics()).
 * uses splitTopic function to do the actual splitting.
 */
function SplitExecute()
{
    global $txt, $board, $topic, $context, $user_info, $smcFunc, $modSettings;
    // Check the session to make sure they meant to do this.
    checkSession();
    // Clean up the subject.
    if (!isset($_POST['subname']) || $_POST['subname'] == '') {
        $_POST['subname'] = $txt['new_topic'];
    }
    // Redirect to the selector if they chose selective.
    if ($_POST['step2'] == 'selective') {
        $_REQUEST['subname'] = $_POST['subname'];
        return SplitSelectTopics();
    }
    $_POST['at'] = (int) $_POST['at'];
    $messagesToBeSplit = array();
    if ($_POST['step2'] == 'afterthis') {
        // Fetch the message IDs of the topic that are at or after the message.
        $request = $smcFunc['db_query']('', '
			SELECT id_msg
			FROM {db_prefix}messages
			WHERE id_topic = {int:current_topic}
				AND id_msg >= {int:split_at}', array('current_topic' => $topic, 'split_at' => $_POST['at']));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $messagesToBeSplit[] = $row['id_msg'];
        }
        $smcFunc['db_free_result']($request);
    } elseif ($_POST['step2'] == 'onlythis') {
        $messagesToBeSplit[] = $_POST['at'];
    } else {
        fatal_lang_error('no_access', false);
    }
    $context['old_topic'] = $topic;
    $context['new_topic'] = splitTopic($topic, $messagesToBeSplit, $_POST['subname']);
    $context['page_title'] = $txt['split'];
}