function SplitSelectionExecute() { global $txt, $board, $topic, $db_prefix, $context, $ID_MEMBER, $user_info; // Make sure the session id was passed with post. checkSession(); // Default the subject in case it's blank. if (!isset($_POST['subname']) || $_POST['subname'] == '') { $_POST['subname'] = $txt['smf258']; } // The old topic's ID is the current one. $split1_ID_TOPIC = $topic; // You must've selected some messages! Can't split out none! if (empty($_SESSION['split_selection'][$topic])) { fatal_lang_error('smf271', false); } $context['old_topic'] = $topic; $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $_POST['subname']); $context['page_title'] = $txt['smf251']; }
/** * Do the actual split of a selection of topics. * is accessed with ?action=splittopics;sa=splitSelection. * uses the main SplitTopics template. * uses splitTopic function to do the actual splitting. */ public function action_splitSelection() { global $txt, $topic, $context; // Make sure the session id was passed with post. checkSession(); require_once SUBSDIR . '/Topic.subs.php'; // You must've selected some messages! Can't split out none! if (empty($_SESSION['split_selection'][$topic])) { $this->_unset_session_values(); fatal_lang_error('no_posts_selected', false); } // This is here because there are two fatal_lang_errors in there $boards = splitDestinationBoard($_SESSION['move_to_board']); $context['old_topic'] = $topic; $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $_SESSION['new_topic_subject']); $context['page_title'] = $txt['split_topic']; $context['sub_template'] = 'split_successful'; splitAttemptMove($boards, $context['new_topic']); // Create a link to this in the old topic. // @todo Does this make sense if the topic was unapproved before? We are not yet sure if the resulting topic is unapproved. if ($_SESSION['messageRedirect']) { postSplitRedirect($_SESSION['reason'], $_SESSION['new_topic_subject'], $boards['destination'], $context['new_topic']); } $this->_unset_session_values(); }
function mob_m_move_post($rpcmsg) { global $board, $sc, $topic, $mobdb, $user_info, $context, $sourcedir, $func; checkSession('session'); require_once $sourcedir . '/SplitTopics.php'; require_once $sourcedir . '/Subs-Boards.php'; require_once $sourcedir . '/Subs-Post.php'; $postinfo = get_postinfo($rpcmsg->getScalarValParam(0)); $topicinfo = get_topicinfo($postinfo['id_topic']); $topic = $postinfo['id_topic']; $board = $postinfo['id_board']; loadBoard(); loadPermissions(); // Make sure this is not the first post if ($postinfo['id_msg'] == $topicinfo['id_first_msg']) { mob_error('cannot move first post of the topic'); } // Are we moving the post to a new topic? if (!is_null($rpcmsg->getScalarValParam(1)) && $rpcmsg->getScalarValParam(1) != '') { // We need to have move_any for this if (!allowedTo('move_any')) { mob_error('cannot move post to a topic'); } $topicinfo = get_topicinfo($rpcmsg->getScalarValParam(1)); if (empty($topicinfo)) { mob_error('topic not found'); } // Split the post into a new one first $new_topic = splitTopic($postinfo['id_topic'], array($postinfo['id_msg']), $postinfo['subject']); if (empty($new_topic)) { mob_error('something bad happened'); } // Merge the topic into the existing one do_merge(array($topicinfo['id_topic'], $new_topic)); } else { $topicinfo = get_topicinfo($topic); // We can have move_own for this if (!(allowedTo('move_any') || allowedTo('move_own') && $user_info['id'] == $topicinfo['id_member_started'])) { mob_error('cannot move post to a new topic'); } $subject = strtr($func['htmlspecialchars']($rpcmsg->getScalarValParam(2)), array("\r" => '', "\n" => '', "\t" => '')); $new_board = $rpcmsg->getParam(3) ? get_boardinfo($rpcmsg->getScalarValParam(3)) : get_boardinfo($postinfo['id_board']); if (trim($subject) == '' || empty($new_board)) { mob_error('subject or board invalid'); } // Split the topic $new_topic = splitTopic($postinfo['id_topic'], array($postinfo['id_msg']), $subject); if (empty($new_topic)) { mob_error('something bad happened'); } if ($board != $new_board['id_board']) { move_topic($new_topic, $board, $new_board, $topicinfo); } } // Return a true response return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean')), 'struct')); }
/** * do the actual split of a selection of topics. * is accessed with ?action=splittopics;sa=splitSelection. * uses the main SplitTopics template. * uses splitTopic function to do the actual splitting. */ function SplitSelectionExecute() { global $txt, $board, $topic, $context, $user_info; // Make sure the session id was passed with post. checkSession(); // Default the subject in case it's blank. if (!isset($_POST['subname']) || $_POST['subname'] == '') { $_POST['subname'] = $txt['new_topic']; } // You must've selected some messages! Can't split out none! if (empty($_SESSION['split_selection'][$topic])) { fatal_lang_error('no_posts_selected', false); } $context['old_topic'] = $topic; $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $_POST['subname']); $context['page_title'] = $txt['split']; }
/** * Do the actual split of a selection of topics. * is accessed with ?action=splittopics;sa=splitSelection. * uses the main SplitTopics template. * uses splitTopic function to do the actual splitting. */ public function action_splitSelection() { global $txt, $topic, $context; // Make sure the session id was passed with post. checkSession(); require_once SUBSDIR . '/Topic.subs.php'; // Default the subject in case it's blank. if (isset($_POST['subname'])) { $this->_new_topic_subject = trim(Util::htmlspecialchars($_POST['subname'])); } if (empty($this->_new_topic_subject)) { $this->_new_topic_subject = $txt['new_topic']; } // You must've selected some messages! Can't split out none! if (empty($_SESSION['split_selection'][$topic])) { fatal_lang_error('no_posts_selected', false); } if (!empty($_POST['messageRedirect']) && empty($context['reason'])) { fatal_lang_error('splittopic_no_reason', false); } $context['move_to_board'] = !empty($_POST['move_to_board']) ? (int) $_POST['move_to_board'] : 0; $reason = !empty($_POST['reason']) ? trim(Util::htmlspecialchars($_POST['reason'], ENT_QUOTES)) : ''; // Make sure they can see the board they are trying to move to (and get whether posts count in the target board). if (!empty($_POST['messageRedirect']) && empty($reason)) { fatal_lang_error('splittopic_no_reason', false); } // This is here because there are two fatal_lang_errors in there $boards = splitDestinationBoard(); $context['old_topic'] = $topic; $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $this->_new_topic_subject); $context['page_title'] = $txt['split_topic']; splitAttemptMove($boards, $context['new_topic']); }