/** * Show PM form * * @access private * @param array Array of errors * @return string returns HTML */ private function _showNewTopicForm($errors = '') { //----------------------------------------- // INIT //----------------------------------------- /* Check max per day */ if ($this->messengerFunctions->checkHasHitMax()) { $this->registry->getClass('output')->showError('maxperday_hit', 10271); } /* Check PM flood */ if ($this->messengerFunctions->floodControlCheck() !== TRUE) { $this->registry->getClass('output')->showError(sprintf($this->lang->words['pm_flood_stop'], $this->messengerFunctions->exceptionData[0]), 010271); } $_msg_id = 0; $formMemberID = intval($this->request['fromMemberID']); # WAS MID $topicID = intval($this->request['topicID']); $preview = $this->request['preview']; $inviteUsers = array(); $displayData = array('errors' => $errors, 'topicID' => $topicID, 'preview' => '', 'name' => '', 'title' => '', 'message' => ''); $_POST['Post-NS'] = isset($_POST['Post']) ? $_POST['Post'] : ''; $_POST['Post'] = IPSText::removeMacrosFromInput(IPSText::raw2form(isset($_POST['Post']) ? $_POST['Post'] : '')); //----------------------------------------- // Preview post? //----------------------------------------- if ($preview) { /* Grab language for attachment previews */ $this->registry->getClass('class_localization')->loadLanguageFile(array("public_topic"), 'forums'); IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html']; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code']; IPSText::getTextClass('bbcode')->parsing_section = 'pms'; IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id']; IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->memberData['mgroup_others']; $this->settings['max_emos'] = 0; $old_msg = IPSText::getTextClass('editor')->processRawPost('Post-NS'); $old_msg = IPSText::getTextClass('bbcode')->preDisplayParse(IPSText::getTextClass('bbcode')->preDbParse($old_msg)); if (!is_object($this->class_attach)) { //----------------------------------------- // Grab render attach class //----------------------------------------- require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php'; $this->class_attach = new class_attach($this->registry); } //----------------------------------------- // Continue... //----------------------------------------- $this->class_attach->type = 'msg'; $this->class_attach->attach_post_key = $this->_postKey; $this->class_attach->init(); $attachData = $this->class_attach->renderAttachments(array(0 => $old_msg)); $displayData['preview'] = $attachData[0]['html'] . $attachData[0]['attachmentHtml']; } //----------------------------------------- // Errors //----------------------------------------- if ($errors or IPSText::getTextClass('bbcode')->error != "") { if (IPSText::getTextClass('bbcode')->error) { $displayData['errors'][] = $this->lang->words[IPSText::getTextClass('bbcode')->error]; } $preview = 1; } //----------------------------------------- // Did we come from a button with a user ID? //----------------------------------------- if ($formMemberID) { $name = IPSMember::load($formMemberID, 'core'); if ($name['member_id']) { $displayData['name'] = $name['members_display_name']; } } else { $displayData['name'] = $this->request['entered_name'] ? $this->request['entered_name'] : ''; } //----------------------------------------- // Are we quoting an old message? //----------------------------------------- if ($preview) { $displayData['message'] = $_POST['Post-NS']; $displayData['title'] = str_replace("'", "'", str_replace('"', '"', IPSText::stripslashes($_POST['msg_title']))); } else { if ($topicID) { $draftTopic = $this->messengerFunctions->fetchTopicDataWithMessage($topicID, TRUE); if ($draftTopic['mt_to_member_id']) { $displayData['name'] = $draftTopic['from_name']; } if ($draftTopic['mt_title']) { $_member = IPSMember::load($draftTopic['mt_to_member_id'], 'core'); $displayData['name'] = $_member['members_display_name']; $displayData['title'] = $draftTopic['mt_title']; $_msg_id = $draftTopic['msg_id']; $this->_postKey = $draftTopic['msg_post_key']; IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html']; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code']; IPSText::getTextClass('bbcode')->parsing_section = 'pms'; $displayData['message'] = IPSText::getTextClass('bbcode')->preEditParse($draftTopic['msg_post']); } } } //----------------------------------------- // CC Boxes //----------------------------------------- if ($this->memberData['g_max_mass_pm'] > 0) { if ($_POST['inviteUsers']) { $displayData['inviteUsers'] = $_POST['inviteUsers']; } else { if ($draftTopic['mt_invited_members']) { $_inviteUsers = $this->messengerFunctions->getInvitedUsers($draftTopic['mt_invited_members']); $__inviteUsers = IPSMember::load($_inviteUsers, 'core'); if (is_array($__inviteUsers)) { $_tmp = array(); foreach ($__inviteUsers as $id => $data) { $_tmp[] = $data['members_display_name']; } if (is_array($_tmp)) { $displayData['inviteUsers'] = implode(", ", $_tmp); } } } } } //----------------------------------------- // Remove side panel //----------------------------------------- IPSText::getTextClass('editor')->remove_side_panel = 1; //----------------------------------------- // PM returns //----------------------------------------- if (IPSText::getTextClass('editor')->method == 'rte' and $displayData['message'] and $fromMsgID) { $displayData['message'] = IPSText::getTextClass('bbcode')->convertForRTE(nl2br($displayData['message'])); } else { if (IPSText::getTextClass('editor')->method == 'std' and $displayData['message'] and $fromMsgID) { $displayData['message'] = IPSText::getTextClass('bbcode')->preEditParse($displayData['message']); } } //----------------------------------------- // Is this RTE? If so, convert BBCode //----------------------------------------- if (IPSText::getTextClass('editor')->method == 'rte' and $displayData['message']) { if (count($errors) or $preview) { $displayData['message'] = stripslashes($displayData['message']); } $displayData['message'] = IPSText::getTextClass('bbcode')->convertForRTE($displayData['message']); } else { if ($displayData['message']) { $displayData['message'] = IPSText::stripslashes($displayData['message']); } } $displayData['editor'] = IPSText::getTextClass('editor')->showEditor($displayData['message'], 'Post'); //----------------------------------------- // More Data... //----------------------------------------- $displayData['uploadData'] = $this->_canUpload ? array('canUpload' => 1) : array('canUpload' => 0); $displayData['postKey'] = $this->_postKey; //----------------------------------------- // Load attachments so we get some stats //----------------------------------------- require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php'; $class_attach = new class_attach($this->registry); $class_attach->type = 'msg'; $class_attach->init(); $class_attach->getUploadFormSettings(); $displayData['uploadData']['attach_stats'] = $class_attach->attach_stats; //----------------------------------------- // Build up the HTML for the send form //----------------------------------------- $this->_title = $this->lang->words['sendMsgTitle']; $this->_navigation[] = array($this->lang->words['sendMsgTitle'], ''); return $this->registry->getClass('output')->getTemplate('messaging')->sendNewPersonalTopicForm($displayData); }
/** * Show the reply form * * @access protected * @param string Type of form (new/reply/add) * @param array Array of extra data * @return void [Passes data to classOutput] */ protected function _displayForm($formType, $extraData = array()) { //----------------------------------------- // Set up //----------------------------------------- $output = ''; $titleText = ''; $buttonText = ''; $doCode = ''; $topText = ''; $checkFunc = ''; //----------------------------------------- // Work out function type //----------------------------------------- switch ($formType) { default: case 'reply': $checkFunc = 'replySetUp'; break; case 'new': $checkFunc = 'topicSetUp'; break; case 'edit': $checkFunc = 'editSetUp'; break; } //----------------------------------------- // Global checks and functions //----------------------------------------- try { $this->globalSetUp(); } catch (Exception $error) { throw new Exception($error->getMessage()); } //----------------------------------------- // Form specific... //----------------------------------------- try { $topic = $this->{$checkFunc}(); } catch (Exception $error) { throw new Exception($error->getMessage()); } //----------------------------------------- // Work out elements //----------------------------------------- switch ($formType) { default: case 'reply': $doCode = 'reply_post_do'; $titleText = $this->lang->words['top_txt_reply'] . ' ' . $topic['title']; $buttonText = $this->lang->words['submit_reply']; $topText = $this->lang->words['replying_in'] . ' ' . $topic['title']; break; case 'new': $doCode = 'new_post_do'; $titleText = $this->lang->words['top_txt_new'] . $this->getForumData('name'); $buttonText = $this->lang->words['submit_new']; $topText = $this->lang->words['posting_new_topic']; break; case 'edit': $doCode = 'edit_post_do'; $titleText = $this->lang->words['top_txt_edit'] . ' ' . $topic['title']; $buttonText = $this->lang->words['submit_edit']; $topText = $this->lang->words['editing_post'] . ' ' . $topic['title']; /* Reset reason for edit */ $extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason']; /* Reset check boxes and such */ $this->setSettings(array('enableSignature' => $this->_originalPost['use_sig'], 'enableEmoticons' => $this->_originalPost['use_emo'], 'post_htmlstatus' => $this->_originalPost['post_htmlstate'], 'enableTracker' => (intval($this->request['enabletrack']) != 0 or $this->getIsPreview() !== TRUE) ? 1 : 0)); break; } //----------------------------------------- // Parse the post, and check for any errors. //----------------------------------------- $post = $this->compilePostData(); $postContent = $this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent(); //----------------------------------------- // Hmmmmm.... //----------------------------------------- $postContent = $this->_afterPostCompile($postContent, $formType); //----------------------------------------- // Compile the poll //----------------------------------------- $this->poll_questions = $this->compilePollData(); //----------------------------------------- // Are we quoting posts? //----------------------------------------- $postContent = $this->_checkMultiQuote($postContent); //----------------------------------------- // RTE? Convert RIGHT tags that QUOTE would // have put there // Commented out 14/7/08 - _afterPostCompile handles this for edit, and should // also handle for any other type if they need it... //----------------------------------------- /*if ( IPSText::getTextClass('editor')->method == 'rte' ) { $postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent ); }*/ //----------------------------------------- // Do we have any posting errors? //----------------------------------------- if ($this->_postErrors) { $output .= $this->registry->getClass('output')->getTemplate('post')->errors($this->lang->words[$this->_postErrors]); } if ($this->getIsPreview()) { $output .= $this->registry->getClass('output')->getTemplate('post')->preview($this->_generatePostPreview($this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent(), $this->post_key)); } /* Defaults */ if (!isset($extraData['checked'])) { $extraData['checked'] = ''; } //----------------------------------------- // Gather status messages //----------------------------------------- /* status from mod posts */ $this->registry->getClass('class_forums')->checkGroupPostPerDay($this->getAuthor(), TRUE); $_statusMsg[] = $this->registry->getClass('class_forums')->ppdStatusMessage; $_statusMsg[] = $this->registry->getClass('class_forums')->fetchPostModerationStatusMessage($this->getAuthor(), $this->getForumData(), $topic, $formType); //----------------------------------------- // Load attachments so we get some stats //----------------------------------------- require_once IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php'; $class_attach = new class_attach($this->registry); $class_attach->type = 'post'; $class_attach->attach_post_key = $this->post_key; $class_attach->init(); $class_attach->getUploadFormSettings(); //----------------------------------------- // START TABLE //----------------------------------------- $output .= $this->registry->getClass('output')->getTemplate('post')->postFormTemplate(array('title' => $titleText, 'captchaHTML' => $this->_generateGuestCaptchaHTML(), 'checkBoxes' => $this->_generateCheckBoxes($formType, isset($topic['tid']) ? $topic['tid'] : 0, $this->getForumData('id')), 'editor' => IPSText::getTextClass('editor')->showEditor($postContent, 'Post'), 'buttonText' => $buttonText, 'uploadForm' => $this->can_upload ? $this->registry->getClass('output')->getTemplate('post')->uploadForm($this->post_key, 'post', $class_attach->attach_stats, $this->getPostID(), $this->getForumData('id')) : "", 'postIconSelected' => $this->_generatePostIcons(), 'topicSummary' => $this->_generateTopicSummary($topic['tid']), 'formType' => $formType, 'extraData' => $extraData, 'modOptionsData' => $this->_generateModOptions($topic, $formType), 'pollBoxHTML' => $this->_generatePollBox($formType), 'canEditTitle' => $this->edit_title, 'topicTitle' => $this->_topicTitle ? $this->_topicTitle : $topic['title'], 'topicDesc' => $this->_topicDescription ? $this->_topicDescription : $topic['description'], 'seoTopic' => $topic['title_seo'], 'seoForum' => $this->getForumData('name_seo'), 'statusMsg' => $_statusMsg), array('doCode' => $doCode, 'p' => $this->getPostID(), 't' => $topic['tid'], 'f' => $this->getForumData('id'), 'parent' => ipsRegistry::$request['parent_id'] ? intval(ipsRegistry::$request['parent_id']) : 0, 'attach_post_key' => $this->post_key)); //----------------------------------------- // Reset multi-quote cookie //----------------------------------------- IPSCookie::set('mqtids', ',', 0); //----------------------------------------- // Send for output //----------------------------------------- $this->registry->getClass('output')->setTitle($topText . ' - ' . $this->settings['board_name']); $this->registry->getClass('output')->addContent($output); $this->nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav($this->getForumData('id')); if (isset($topic['tid']) and $topic['tid']) { $this->nav[] = array($topic['title'], "showtopic={$topic['tid']}", $topic['title_seo'], 'showtopic'); } if (is_array($this->nav) and count($this->nav)) { foreach ($this->nav as $_nav) { $this->registry->getClass('output')->addNavigation($_nav[0], $_nav[1], $_nav[2], $_nav[3]); } } $this->registry->getClass('output')->sendOutput(); }