Esempio n. 1
0
 /**
  * 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();
 }
 /**
  * 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']);
 }