/** * * Creates a new post. * This function creates a new post. Also automatically updates all database counters. * * @author Martin Helmich * @version 2007-07-23 * @param int $topicId The UID of the topic the new post is to be created in * @param int $author The UID of the fe_user creating this post * @param string $text The post's text * @param int $date The date of post creation as unix timestamp * @param string $ip The post author's IP address * @param array $attachments An array of attachments that are to be attached * to this post. * @param boolean $noUpdate Set to TRUE in order to prevent the database counters from * being updated directly after creating this post. Instead, * the elements to be updated will be stored in an "update queue" * and will be updated after all posts/topics have been created. * This minimizes database load. * @param boolean $subscribe * @return int/boolean If post creation was successfull, the post's UID is returned, * otherwise FALSE. */ function create_post($topicId, $author, $text, $date, $ip, $attachments = array(), $noUpdate = false, $subscribe = FALSE) { $author = intval($author); // Retrieve forum uid $forumId = $this->getForumUIDByTopic($topicId); if ($forumId === false) { return false; } // Generate post record $insertArray = array('pid' => $this->getFirstPid(), 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'topic_id' => $topicId, 'forum_id' => $forumId, 'poster_id' => $author, 'post_time' => $date, 'poster_ip' => $ip, 'attachment' => is_array($attachments) ? implode(',', $attachments) : ''); // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['postfactory']['insertPost'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['postfactory']['insertPost'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $insertArray = $_procObj->processPostInsertArray($insertArray, $this); } } // Insert post record if (!$this->databaseHandle->exec_INSERTquery('tx_mmforum_posts', $insertArray)) { return false; } // Retrieve post uid $postId = $this->databaseHandle->sql_insert_id(); // Update attachment record if (is_array($attachments) && count($attachments)) { $this->databaseHandle->exec_UPDATEquery('tx_mmforum_attachments', 'uid IN (' . implode(',', $attachments) . ')', array('post_id' => $postId)); } // Generate post text record $insertArray = array('pid' => $this->getFirstPid(), 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'post_id' => $postId, 'post_text' => $text, 'cache_text' => $text); // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['postfactory']['insertPostText'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['postfactory']['insertPostText'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $insertArray = $_procObj->processPostTextInsertArray($insertArray, $this); } } // Insert post text record if (!$this->databaseHandle->exec_INSERTquery('tx_mmforum_posts_text', $insertArray)) { $this->databaseHandle->exec_DELETEquery('tx_mmforum_posts', 'uid = ' . $postId); return false; } // Clear topic for indexing if (class_exists('tx_mmforum_indexing')) { tx_mmforum_indexing::delete_topic_ind_date($topicId); } // Send notification email to users who have subscribed this topic if ($this->parent != null) { // Subscribe to the topic if ($subscribe) { $this->tx_mmforum_havealook->addSubscription($this->parent, $topicId, $author); } $this->tx_mmforum_havealook->notifyTopicSubscribers($topicId, $this->parent); } // Set topic for all users to "not read" $this->databaseHandle->exec_DELETEquery('tx_mmforum_postsread', 'topic_id = ' . $topicId); // Update topic and forum post counters if (!$noUpdate) { $this->updateTopicPostCount($topicId); $this->updateForumPostCount($forumId); $this->updateUserPostCount($author); } else { $this->updateQueue_addTopic($topicId); $this->updateQueue_addForum($forumId); $this->updateQueue_addUser($author); } return $postId; }
/** * if an admin uses the "admin panel" options, this functions makes sure * that all the values are properly saved * * @param array $topicData the data of the topic * @return void */ function saveAdminChanges($topicData) { $topicId = intval($this->piVars['tid']); if ($this->piVars['saveAdmin'] == 1 && ($this->getIsAdmin() || $this->getIsMod($topicData['forum_id']))) { // move topic to another forum $changeForumId = intval($this->piVars['change_forum_id']); $oldForumId = $topicData['forum_id']; if ($changeForumId > 0 && $changeForumId != $oldForumId) { // Generate shadow record if ($this->conf['enableShadows']) { $shadow_insertArray = array('pid' => $topicData['pid'], 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'topic_title' => $topicData['topic_title'], 'topic_poster' => $topicData['topic_poster'], 'topic_time' => $topicData['topic_time'], 'topic_views' => $topicData['topic_views'], 'topic_replies' => $topicData['topic_replies'], 'topic_last_post_id' => $topicData['topic_last_post_id'], 'forum_id' => $topicData['forum_id'], 'topic_first_post_id' => $topicData['topic_first_post_id'], 'shadow_tid' => $topicData['uid'], 'shadow_fid' => $changeForumId); $this->databaseHandle->exec_INSERTquery('tx_mmforum_topics', $shadow_insertArray); } // Update new board UID $updateArray = array('forum_id' => $changeForumId); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'uid = ' . $topicId, $updateArray); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'topic_id = ' . $topicId, $updateArray); // update the posts in the old and the new forum $this->update_lastpost_forum($changeForumId); $this->update_lastpost_forum($oldForumId); $this->update_lastpost_topic($topicId); $this->update_forum_posts_n_topics($oldForumId); $this->update_forum_posts_n_topics($changeForumId); // Clearance for new indexing tx_mmforum_indexing::delete_topic_ind_date($topicId); } $atTopFlag = $this->piVars['at_top'] ? 1 : 0; $readFlag = $this->piVars['read_flag'] ? 1 : 0; $closedFlag = $this->piVars['closed_flag'] ? 1 : 0; $deleteFlag = $this->piVars['delete_flag'] ? 1 : 0; $threadTitle = $this->piVars['threadtitel']; // update all other values $updateArray = array('at_top_flag' => $atTopFlag, 'read_flag' => $readFlag, 'closed_flag' => $closedFlag, 'deleted' => $deleteFlag, 'topic_title' => $threadTitle, 'tx_mmforumsearch_index_write' => 0); if ($this->piVars['prefix_selected']) { $updateArray['topic_is'] = $this->piVars['prefix_selected']; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['saveAdminChanges_updateArray'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['saveAdminChanges_updateArray'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $updateArray = $_procObj->saveAdminChanges_updateArray($updateArray, $this); } } $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'uid = ' . $topicId, $updateArray); if ($this->conf['enableShadows'] == true) { $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'shadow_tid = ' . $topicId, $updateArray); } if ($deleteFlag) { $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_topics', 'uid = ' . $topicId . $this->getStoragePIDQuery()); $topicData = $this->databaseHandle->sql_fetch_assoc($res); // delete all posts $updateArray = array('deleted' => 1, 'tstamp' => $GLOBALS['EXEC_TIME'], 'tx_mmforumsearch_index_write' => 0); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'topic_id = ' . $topicData['uid'], $updateArray); //mark all posts_text as deleted $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts_text', 'post_id IN (SELECT uid FROM tx_mmforum_posts WHERE topic_id = ' . $topicData['uid'] . ')', array('deleted' => 1)); // get all posters of this thread, and update their posts $uRes = $this->databaseHandle->exec_SELECTquery('poster_id', 'tx_mmforum_posts', 'topic_id = ' . $topicId . ' AND deleted = 0 AND hidden = 0' . $this->getStoragePIDQuery(), 'poster_id'); while ($row = $this->databaseHandle->sql_fetch_assoc($uRes)) { $this->update_user_posts($row['poster_id']); } $this->update_forum_posts_n_topics($topicData['forum_id']); $linkParams[$this->prefixId] = array('action' => 'list_topic', 'fid' => $topicData['forum_id']); $link = $this->pi_getPageLink($this->getForumPID(), '', $linkParams); HttpUtility::redirect($link); } unset($this->piVars['saveAdmin']); unset($this->piVars['change_forum_id']); unset($this->piVars['at_top']); unset($this->piVars['read_flag']); unset($this->piVars['closed_flag']); unset($this->piVars['delete_flag']); unset($this->piVars['threadtitel']); unset($this->piVars['prefix_user']); unset($this->piVars['prefix_selected']); } }
/** * Displays the form for editing an existing post. Regular users can only edit their own * posts if they have not been answered yet. Moderators and administrators can edit all * posts, regardless if they have been answered or not. * @param string $content The plugin content * @param array $conf The plugin's configuration vars * @return string The content */ function post_edit($content, $conf) { $postId = intval($this->piVars['pid']); $this->generateToken(); // Get topic UID $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_posts', 'deleted=0 AND hidden=0 AND uid=' . $postId . $this->getStoragePIDQuery()); $row = $this->databaseHandle->sql_fetch_assoc($res); $topicId = $row['topic_id']; $forumId = $row['forum_id']; // Determine, if edited post is the last post in topic $res = $this->databaseHandle->exec_SELECTquery('MAX(post_time)', 'tx_mmforum_posts', 'deleted=0 AND hidden=0 AND topic_id=' . $topicId . $this->getStoragePIDQuery()); list($lastpostdate) = $this->databaseHandle->sql_fetch_row($res); // Determine if edited post is the first post in topic $res = $this->databaseHandle->exec_SELECTquery('uid', 'tx_mmforum_posts', 'deleted=0 AND hidden=0 AND topic_id=' . $topicId . ' ' . $this->getStoragePIDQuery(), '', 'post_time ASC'); list($firstPostId) = $this->databaseHandle->sql_fetch_row($res); $firstPost = $postId === intval($firstPostId); // Load topic data $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_topics', 'deleted=0 AND hidden=0 AND uid=' . $topicId . $this->getStoragePIDQuery()); $topicData = $this->databaseHandle->sql_fetch_assoc($res); $previewContent = ''; if ($row['poster_id'] == $GLOBALS['TSFE']->fe_user->user['uid'] && $lastpostdate == $row['post_time'] && $topicData['closed_flag'] != 1 or $this->getIsAdmin() or $this->getIsMod($row['forum_id'])) { //Check CSRF Attacks if ($GLOBALS["TSFE"]->fe_user->getKey('ses', "token") == $this->piVars['token'] || $this->piVars['token'] == false) { $content .= $this->errorMessage($this->conf, $this->pi_getLL('newPost.quote.error')); return $this->new_post($content, $conf); } if ($this->piVars['button'] == $this->pi_getLL('newPost.save')) { // Write changes to database $updateArray = array('post_text' => $this->piVars['message'], 'tstamp' => $GLOBALS['EXEC_TIME']); $res = $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts_text', 'post_id=' . $postId, $updateArray); // check for attachments that should be deleted if ($this->piVars['attachment_delete']) { foreach ($this->piVars['attachment_delete'] as $attachementId => $delete) { $attachementId = intval($attachementId); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_attachments', 'uid=' . $attachementId, array('deleted' => 1, 'tstamp' => $GLOBALS['EXEC_TIME'])); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'uid=' . $attachementId, array('attachment' => 0, 'tstamp' => $GLOBALS['EXEC_TIME'])); $attachments = GeneralUtility::intExplode(',', $row['attachment']); unset($attachments[array_search($attachementId, $attachments)]); $row['attachment'] = implode(',', $attachments); } $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'uid=' . $postId, array('attachment' => $row['attachment'])); } // Check for new file uploads / attachments if ($_FILES['tx_mmforum_pi1_attachment_1']['size'] > 0) { $res = $this->performAttachmentUpload(); if (!is_array($res)) { $content .= $res; unset($this->piVars['button']); return $this->post_edit($content, $conf); } else { $attachmentIds = $res; $attachments = GeneralUtility::intExplode(',', $row['attachment']); $attachments = tx_mmforum_tools::processArray_numeric($attachments); $updateData = array('attachment' => implode(',', array_merge($attachments, $attachmentIds))); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'uid = ' . $postId, $updateData); // Update attachment records with the post ID (as this is not set within the performAttachmentUpload) if (count($attachmentIds)) { $this->databaseHandle->exec_UPDATEquery('tx_mmforum_attachments', 'uid IN (' . implode(',', $attachmentIds) . ')', array('post_id' => $postId)); } } } else { $attachmentIds = null; } if ($this->conf['polls.']['enable']) { if ($this->piVars['enable_poll'] == '1' && $firstPost) { $pollObj = GeneralUtility::makeInstance('tx_mmforum_polls'); /* @var $pollObj tx_mmforum_polls */ if ($topicData['poll_id'] > 0) { $res = $pollObj->editPoll($topicData['poll_id'], $this->piVars['poll'], $this); if ($res) { $content .= $this->errorMessage($this->conf, $res); unset($this->piVars['button']); return $this->post_edit($content, $conf); } } else { $pollId = $pollObj->createPoll($this->piVars['poll'], $this); if (!is_numeric($pollId)) { $content .= $this->errorMessage($this->conf, $pollId); unset($this->piVars['button']); return $this->post_edit($content, $conf); } $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'uid=' . $topicId, array('poll_id' => $pollId, 'tstamp' => $GLOBALS['EXEC_TIME'])); } } else { if ($firstPost && $topicData['poll_id'] > 0) { $pollObj = GeneralUtility::makeInstance('tx_mmforum_polls'); $pollObj->deletePoll($topicData['poll_id'], $topicData['uid']); } } } if ($this->piVars['title'] and $this->getIsMod($row['forum_id']) || $this->getIsAdmin() || $firstPost && $row['poster_id'] == $GLOBALS['TSFE']->fe_user->user['uid']) { $updateArray = array('topic_title' => $this->piVars['title'], 'tstamp' => $GLOBALS['EXEC_TIME']); $res = $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'uid=' . $topicId, $updateArray); } // If the editing user is no admin or mod, the change is logged in the database if (!$this->getIsMod($row['forum_id']) && !$this->getIsAdmin()) { $this->databaseHandle->exec_UPDATEquery('tx_mmforum_posts', 'uid=' . $postId, array('edit_count' => intval($row['edit_count']) + 1, 'edit_time' => $GLOBALS['EXEC_TIME'])); } // Clearing for new indexing tx_mmforum_indexing::delete_topic_ind_date($topicId); $linkParams[$this->prefixId] = array('action' => 'list_post', 'tid' => $topicId, 'pid' => $this->piVars['pid']); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['postEdit_linkParams'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['postEdit_linkParams'] as $classRef) { $procObj =& GeneralUtility::getUserObj($classRef); $linkParams = $procObj->postEdit_linkParams($linkParams, $this); } } $link = $this->pi_getPageLink($GLOBALS['TSFE']->id, '', $linkParams); HttpUtility::redirect($link . '#pid' . $postId); } else { // Display post preview if ($this->piVars['button'] == $this->pi_getLL('newPost.preview')) { if ($this->piVars['enable_poll'] == '1' && $this->conf['polls.']['enable']) { $content .= tx_mmforum_polls::displayPreview($this->piVars['poll'], $this); } $template = $this->cObj->fileResource($conf['template.']['list_post']); $template = $this->cObj->getSubpart($template, "###LIST_POSTS###"); $template = $this->cObj->substituteSubpart($template, '###ATTACHMENT_SECTION###', ''); $posttext = $this->piVars['message']; $posttext = $this->tx_mmforum_postparser->main($this, $conf, $posttext, 'textparser'); $marker['###POSTOPTIONS###'] = ''; $marker['###SOLVEDOPTION###'] = ''; $marker['###POSTMENU###'] = ''; $marker['###POSTUSER###'] = $this->ident_user($row['poster_id'], $conf); $marker['###POSTTEXT###'] = $posttext; $marker['###ANKER###'] = ''; $marker['###POSTANCHOR###'] = ''; $marker['###POSTDATE###'] = $this->pi_getLL('post.writtenOn') . ': ' . $this->formatDate($topicData['topic_time']); $marker['###POSTRATING###'] = ''; // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_INpreviewMarker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_INpreviewMarker'] as $classRef) { $procObj =& GeneralUtility::getUserObj($classRef); $marker = $procObj->editPost_INpreviewMarker($marker, $this); } } $previewTemplate = $this->cObj->fileResource($conf['template.']['new_post']); $previewTemplate = $this->cObj->getSubpart($previewTemplate, '###PREVIEW###'); $previewMarker = array("###TOPIC_TITLE###" => $this->escape($this->piVars['topicname']), "###LABEL_PREVIEW###" => $this->pi_getLL('newTopic.preview'), "###PREVIEW_POST###" => $this->cObj->substituteMarkerArrayCached($template, $marker)); // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_previewMarker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_previewMarker'] as $classRef) { $procObj =& GeneralUtility::getUserObj($classRef); $previewMarker = $procObj->editPost_previewMarker($previewMarker, $this); } } $previewContent = $this->cObj->substituteMarkerArrayCached($previewTemplate, $previewMarker); } $template = $this->cObj->fileResource($conf['template.']['new_post']); $template = $this->cObj->getSubpart($template, stristr($template, '###NEWTOPIC###') === false ? '###NEWPOST###' : '###NEWTOPIC###'); // compatibility: typo in template file fixed. was 'NEWTOPIC' $attachments = GeneralUtility::intExplode(',', $row['attachment']); $attachments = tx_mmforum_tools::processArray_numeric($attachments); $attachCount = count($attachments); if ($attachCount == $this->conf['attachments.']['maxCount'] || !$this->conf['attachments.']['enable']) { $template = $this->cObj->substituteSubpart($template, "###ATTACHMENT_SECTION###", ''); } else { $attachDiff = $this->conf['attachments.']['maxCount'] - $attachCount; $aTemplate = $this->cObj->getSubpart($template, '###ATTACHMENT_FIELD###'); $aContent = ''; for ($i = 1; $i <= $attachDiff; $i++) { $aMarker = array('###ATTACHMENT_NO###' => $i); $aContent .= $this->cObj->substituteMarkerArray($aTemplate, $aMarker); } $marker = array('###LABEL_ATTACHMENT###' => $this->pi_getLL('newPost.attachment'), '###MAXFILESIZE###' => $this->conf['attachments.']['maxFileSize']); // Maximum file size $mFileSize = $this->conf['attachments.']['maxFileSize'] . ' B'; if ($this->conf['attachments.']['maxFileSize'] >= 1024) { $mFileSize = round($this->conf['attachments.']['maxFileSize'] / 1024, 2) . ' KB'; } if ($this->conf['attachments.']['maxFileSize'] >= 1024 * 1024) { $mFileSize = round($this->conf['attachments.']['maxFileSize'] / (1024 * 1024), 2) . ' MB'; } $marker['###MAXFILESIZE_TEXT###'] = sprintf($this->pi_getLL('newPost.maxFileSize'), $mFileSize); $marker['###MAXFILESIZE_TEXT###'] = $this->cObj->stdWrap($marker['###MAXFILESIZE_TEXT###'], $this->conf['attachments.']['maxFileSize_stdWrap.']); $marker['###TOKEN###'] = $GLOBALS["TSFE"]->fe_user->getKey('ses', "token"); $template = $this->cObj->substituteMarkerArray($template, $marker); $template = $this->cObj->substituteSubpart($template, '###ATTACHMENT_FIELD###', $aContent); } $marker = array(); if (strlen($row['attachment']) == 0) { $template = $this->cObj->substituteSubpart($template, '###ATTACHMENT_EDITSECTION###', ''); } else { $aRes = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_attachments', 'uid IN (' . $row['attachment'] . ') AND deleted=0', '', 'uid ASC'); $marker['###LABEL_ATTACHMENT###'] = $this->pi_getLL('newPost.attachment'); $aTemplate = $this->cObj->getSubpart($template, '###ATTACHMENT_EDITFIELD###'); $aContent = ''; while ($attachment = $this->databaseHandle->sql_fetch_assoc($aRes)) { $size = $attachment['file_size'] . ' ' . $this->pi_getLL('attachment.bytes'); if ($attachment['file_size'] > 1024) { $size = round($attachment['file_size'] / 1024, 2) . ' ' . $this->pi_getLL('attachment.kilobytes'); } if ($attachment['file_size'] > 1048576) { $size = round($attachment['file_size'] / 1048576, 2) . ' ' . $this->pi_getLL('attachment.megabytes'); } $aMarker['###LABEL_DELETEATTACHMENT###'] = $this->pi_getLL('attachment.delete'); $sAttachment = $attachment['file_name'] . ' (' . $this->pi_getLL('attachment.type') . ': ' . $attachment['file_type'] . ', ' . $this->pi_getLL('attachment.size') . ': ' . $size . '), ' . $attachment['downloads'] . ' ' . $this->pi_getLL('attachment.downloads'); $sAttachment = $this->escape($sAttachment); $sAttachment = $this->cObj->stdWrap($sAttachment, $this->conf['attachments.']['attachmentEditLabel_stdWrap.']); $aMarker['###ATTACHMENT_DATA###'] = $sAttachment; $aMarker['###ATTACHMENT_UID###'] = $attachment['uid']; $aContent .= $this->cObj->substituteMarkerArray($aTemplate, $aMarker); } $template = $this->cObj->substituteSubpart($template, '###ATTACHMENT_EDITFIELD###', $aContent); } if ($firstPost && $this->conf['polls.']['enable']) { $pollObj = GeneralUtility::makeInstance('tx_mmforum_polls'); if ($topicData['poll_id'] == 0) { $marker['###POLL###'] = $pollObj->display_createForm($this->piVars['poll'] ? $this->piVars['poll'] : array(), $this); $marker['###ENABLE_POLL###'] = $this->piVars['enable_poll'] ? 'checked="checked"' : ''; $marker['###POLLDIV_STYLE###'] = $this->piVars['enable_poll'] ? '' : 'style="display:none;"'; $marker['###LABEL_POLL_CE###'] = $this->pi_getLL('poll.postattach.new'); $marker['###DISABLE_POLL###'] = ''; $marker['###DISABLE_POLL_VAR###'] = 0; $marker['###CALLPOLLJS###'] = $this->conf['callpolljs']; } else { $pollEnabled = $pollObj->getMayEditPoll($topicData['poll_id'], $this); $marker['###POLL###'] = $pollObj->display_editForm($topicData['poll_id'], $this->piVars['poll'] ? $this->piVars['poll'] : array(), $this); $marker['###ENABLE_POLL###'] = 'checked="checked"'; $marker['###POLLDIV_STYLE###'] = ''; $marker['###LABEL_POLL_CE###'] = $this->pi_getLL('poll.postattach.edit'); $marker['###DISABLE_POLL###'] = $pollEnabled ? '' : 'disabled="disabled"'; $marker['###DISABLE_POLL_VAR###'] = $pollEnabled ? 0 : 1; $marker['###CALLPOLLJS###'] = $this->conf['callpolljs']; } $marker['###LABEL_POLL###'] = $this->pi_getLL('poll.postattach'); } else { $template = $this->cObj->substituteSubpart($template, '###POLL_SECTION###', ''); } $res = $this->databaseHandle->exec_SELECTquery('post_text', 'tx_mmforum_posts_text', 'post_id=' . $postId); list($posttext) = $this->databaseHandle->sql_fetch_row($res); $res = $this->databaseHandle->exec_SELECTquery('topic_title', 'tx_mmforum_topics', 'uid=' . $topicId); list($title) = $this->databaseHandle->sql_fetch_row($res); $marker['###POSTTEXT###'] = $this->piVars['message'] ? $this->escape($this->piVars['message']) : $this->escape($posttext); if ($this->getIsMod($row['forum_id']) || $this->getIsAdmin()) { $marker['###POSTTITLE###'] = '<input type="text" name="tx_mmforum_pi1[title]" size="50" value="' . $this->escape($title) . '" style="width:80%;"></div>'; } else { if ($firstPost && $row['poster_id'] == $GLOBALS['TSFE']->fe_user->user['uid']) { $marker['###POSTTITLE###'] = '<input type="text" name="tx_mmforum_pi1[title]" size="50" value="' . $this->escape($title) . '" style="width:80%;"></div>'; } else { $marker['###POSTTITLE###'] = $this->escape($title); } } $marker['###OLDPOSTTEXT###'] = ''; $marker['###SMILIES###'] = $this->show_smilie_db($conf); $marker['###SOLVEDOPTION###'] = ''; $marker['###ACTION###'] = htmlspecialchars($this->pi_getPageLink($GLOBALS['TSFE']->id, '', array($this->prefixId => array('action' => 'post_edit', 'pid' => $postId)))); $marker['###LABEL_SEND###'] = $this->pi_getLL('newPost.save'); $marker['###LABEL_PREVIEW###'] = $this->pi_getLL('newPost.preview'); $marker['###LABEL_RESET###'] = $this->pi_getLL('newPost.reset'); $marker['###LABEL_ATTENTION###'] = $this->pi_getLL('newPost.attention'); $marker['###LABEL_NOTECODESAMPLES###'] = $this->pi_getLL('newPost.codeSamples'); $marker['###TOPICICON###'] = $this->getTopicIcon($topicData); $marker['###TOPICTITLE###'] = $this->escape($topicData['topic_title']); // no have-a-look on post edit $template = $this->cObj->substituteSubpart($template, '###HAVEALOOK_SECTION###', ''); $bbCodeButtons_template = $this->cObj->getSubpart($template, '###BBCODEBUTTONS###'); if (empty($conf['jQueryEditorJavaScript'])) { $bbCodeButtons = $this->generateBBCodeButtons($bbCodeButtons_template); } else { $bbCodeButtons = stristr($bbCodeButtons_template, '<td>') ? '<td></td>' : ''; } $template = $this->cObj->substituteSubpart($template, '###BBCODEBUTTONS###', $bbCodeButtons); $template = str_replace('###POLLJAVASCRIPT###', $this->conf['polljavascript'], $template); if ($this->conf['disableRootline']) { $template = $this->cObj->substituteSubpart($template, '###ROOTLINE_CONTAINER###', ''); } else { $marker['###FORUMPATH###'] = $this->get_forum_path($forumId, $topicId); } } } else { $template = $this->cObj->fileResource($conf['template.']['error']); $marker = array('###ERROR###' => $this->pi_getLL('editPost.noAccess')); } // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_formMarker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['editPost_formMarker'] as $classRef) { $procObj =& GeneralUtility::getUserObj($classRef); $marker = $procObj->editPost_formMarker($marker, $this); } } $marker['###STARTJAVASCRIPT###'] = $this->includeEditorJavaScript(); $marker['###POST_PREVIEW###'] = (string) $previewContent; $content .= $this->cObj->substituteMarkerArrayCached($template, $marker); return $content; }