Exemplo n.º 1
0
 private function getModifiedReOnSubject($on_reply = false)
 {
     $subject = $this->objCurrentPost->getSubject();
     $re_txt = $this->lng->txt('post_reply');
     $re_txt_with_num = str_replace(':', '(', $re_txt);
     $search_length = strlen($re_txt_with_num);
     $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
     if ($comp == 0) {
         $modified_subject = $subject;
         if ($on_reply == true) {
             // i.e. $subject = "Re(12):"
             $str_pos_start = strpos($subject, '(');
             $str_pos_end = strpos($subject, ')');
             $length = (int) $str_pos_end - (int) $str_pos_start;
             $str_pos_start++;
             $txt_number = substr($subject, $str_pos_start, $length - 1);
             if (is_numeric($txt_number)) {
                 $re_count = (int) $txt_number + 1;
                 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
             }
         }
     } else {
         $re_count = substr_count($subject, $re_txt);
         if ($re_count >= 1 && $on_reply == true) {
             $subject = str_replace($re_txt, '', $subject);
             // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
             $re_count++;
             $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
         } else {
             if ($re_count >= 1 && $on_reply == false) {
                 // possibility to modify the subject only for output
                 // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
                 $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
             } else {
                 if ($re_count == 0) {
                     // the first reply to a thread
                     $modified_subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
                 }
             }
         }
     }
     return $modified_subject;
 }
 /**
  * Print Posting.
  *
  */
 function printPost()
 {
     global $tpl, $lng, $ilAccess, $ilias;
     if (!$ilAccess->checkAccess('read,visible', '', $_GET['ref_id'])) {
         $ilias->raiseError($lng->txt('permission_denied'), $ilias->error_obj->MESSAGE);
     }
     $tplEx = new ilTemplate('tpl.forums_export_print.html', true, true, 'Modules/Forum');
     $tplEx->setVariable('CSSPATH', $tpl->tplPath);
     // get forum- and thread-data
     $this->frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($_GET['top_pk']));
     if (is_array($frmData = $this->frm->getOneTopic())) {
         // post object
         $post = new ilForumPost((int) $_GET['print_post']);
         // headline
         $tplEx->setVariable('HEADLINE', $lng->txt('forum') . ': ' . $frmData['top_name'] . ' > ' . $lng->txt('forums_thread') . ': ' . $post->getThread()->getSubject());
         $tplEx->setCurrentBlock('posts_row');
         $tplEx->setVariable('ROWCOL', 'tblrow2');
         $authorinfo = new ilForumAuthorInformation($post->getUserId(), $post->getUserAlias(), $post->getImportName());
         $tplEx->setVariable('AUTHOR', $authorinfo->getAuthorName());
         if ($post->getUserId()) {
             // get create- and update-dates
             if ($post->getUpdateUserId()) {
                 $authorinfo = new ilForumAuthorInformation($post->getUpdateUserId(), '', '');
                 $tplEx->setVariable('POST_UPDATE', "<br />[" . $lng->txt('edited_on') . ": " . $this->frm->convertDate($post->getChangeDate()) . " - " . strtolower($lng->txt('from')) . " " . $authorinfo->getAuthorName() . "]");
             }
             if ($ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])) {
                 $numPosts = $this->frm->countUserArticles($post->getUserId());
             } else {
                 $numPosts = $this->frm->countActiveUserArticles($post->getUserId());
             }
         }
         $tplEx->setVariable('SUBJECT', $post->getSubject());
         $tplEx->setVariable('TXT_CREATE_DATE', $lng->txt('forums_thread_create_date'));
         $tplEx->setVariable('POST_DATE', $this->frm->convertDate($post->getCreateDate()));
         $tplEx->setVariable('SPACER', "<hr noshade width=\"100%\" size=\"1\" align=\"center\" />");
         if ($post->isCensored()) {
             $tplEx->setVariable('POST', nl2br(stripslashes($post->getCensorshipComment())));
         } else {
             /** @todo mjansen: possible bugfix for mantis #8223 */
             if ($post->getMessage() == strip_tags($post->getMessage())) {
                 // We can be sure, that there are not html tags
                 $post->setMessage(nl2br($post->getMessage()));
             }
             $tplEx->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($this->frm->prepareText($post->getMessage(), 0, '', 'export'), 1));
         }
         $tplEx->parseCurrentBlock('posts_row');
         $tplEx->setCurrentBlock('posttable');
         $tplEx->setVariable('TXT_AUTHOR', $lng->txt('author'));
         $tplEx->setVariable('TXT_POST', $lng->txt('forums_thread') . ': ' . $post->getThread()->getSubject());
         $tplEx->parseCurrentBlock('posttable');
     }
     // if (is_array($frmData = $this->frm->getOneTopic()))
     $tplEx->show();
 }
Exemplo n.º 3
0
    /**
     * generate new dataset in frm_posts
     * @param	integer	$topic
     * @param	integer	$thread
     * @param	integer	$user
     * @param	string	$message	
     * @param	integer	$parent_pos	
     * @param	integer	$notify	
     * @param	integer	$anonymize	
     * @param	string	$subject	
     * @param	datetime	$date	
     * @return	integer	$lastInsert: new post ID
     * @access	public
     */
    public function generatePost($forum_id, $thread_id, $user, $message, $parent_pos, $notify, $subject = '', $alias = '', $date = '', $status = 1, $send_activation_mail = 0)
    {
        global $ilUser, $ilDB;
        $objNewPost = new ilForumPost();
        $objNewPost->setForumId($forum_id);
        $objNewPost->setThreadId($thread_id);
        $objNewPost->setSubject($subject);
        $objNewPost->setMessage($message);
        $objNewPost->setUserId($user);
        $objNewPost->setUserAlias($alias);
        if ($date == "") {
            $objNewPost->setCreateDate(date("Y-m-d H:i:s"));
        } else {
            if (strpos($date, "-") > 0) {
                $objNewPost->setCreateDate($date);
            } else {
                $objNewPost->setCreateDate(date("Y-m-d H:i:s", $date));
            }
        }
        $objNewPost->setImportName($this->getImportName());
        $objNewPost->setNotification($notify);
        $objNewPost->setStatus($status);
        $objNewPost->insert();
        // entry in tree-table
        if ($parent_pos == 0) {
            $this->addPostTree($objNewPost->getThreadId(), $objNewPost->getId(), $objNewPost->getCreateDate());
        } else {
            $this->insertPostNode($objNewPost->getId(), $parent_pos, $objNewPost->getThreadId(), $objNewPost->getCreateDate());
        }
        //echo "<br>->".$objNewPost->getId()."-".$parent_pos."-".$objNewPost->getThreadId()."-".
        //	$objNewPost->getCreateDate()."-".$forum_id."-".$message."-".$user."-";
        // string last post
        $lastPost = $objNewPost->getForumId() . "#" . $objNewPost->getThreadId() . "#" . $objNewPost->getId();
        // update thread
        $result = $ilDB->manipulateF('
			UPDATE frm_threads 
			SET thr_num_posts = thr_num_posts + 1,
				thr_last_post = %s
			WHERE thr_pk = %s', array('text', 'integer'), array($lastPost, $objNewPost->getThreadId()));
        // update forum
        $result = $ilDB->manipulateF('
			UPDATE frm_data 
			SET top_num_posts = top_num_posts + 1,
			 	top_last_post = %s
			WHERE top_pk = %s', array('text', 'integer'), array($lastPost, $objNewPost->getForumId()));
        // MARK READ
        $forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId());
        $forum_obj->markPostRead($objNewPost->getUserId(), $objNewPost->getThreadId(), $objNewPost->getId());
        $pos_data = $objNewPost->getDataAsArray();
        $pos_data["ref_id"] = $this->getForumRefId();
        // Send notification to moderators if they have to enable a post
        if (!$status && $send_activation_mail) {
            $pos_data["top_name"] = $forum_obj->getTitle();
            $this->sendPostActivationNotification($pos_data);
        }
        // Add Notification to news
        if ($status) {
            require_once 'Services/RTE/classes/class.ilRTE.php';
            include_once "./Services/News/classes/class.ilNewsItem.php";
            $news_item = new ilNewsItem();
            $news_item->setContext($forum_obj->getId(), 'frm', $objNewPost->getId(), 'pos');
            $news_item->setPriority(NEWS_NOTICE);
            $news_item->setTitle($objNewPost->getSubject());
            $news_item->setContent(ilRTE::_replaceMediaObjectImageSrc($this->prepareText($objNewPost->getMessage(), 0), 1));
            $news_item->setUserId($user);
            $news_item->setVisibility(NEWS_USERS);
            $news_item->create();
        }
        return $objNewPost->getId();
    }
Exemplo n.º 4
0
 public function viewThreadObject()
 {
     /**
      * @var $tpl ilTemplate
      * @var $lng ilLanguage
      * @var $ilUser ilObjUser
      * @var $ilAccess ilAccessHandler
      * @var $rbacreview ilRbacReview
      * @var $ilNavigationHistory ilNavigationHistory
      * @var $ilCtrl ilCtrl
      * @var $ilToolbar ilToolbarGUI
      */
     global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator;
     $tpl->addCss('./Modules/Forum/css/forum_tree.css');
     if (!isset($_SESSION['viewmode'])) {
         $_SESSION['viewmode'] = $this->objProperties->getDefaultView();
     }
     // quick and dirty: check for treeview
     if (!isset($_SESSION['thread_control']['old'])) {
         $_SESSION['thread_control']['old'] = $_GET['thr_pk'];
         $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
     } else {
         if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) {
             $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
         }
     }
     if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) {
         $_SESSION['viewmode'] = $_GET['viewmode'];
     }
     if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_TREE;
     } else {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_DATE;
     }
     if (!$ilAccess->checkAccess('read,visible', '', $this->object->getRefId())) {
         $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // init objects
     $oForumObjects = $this->getForumObjects();
     /**
      * @var $forumObj ilObjForum
      */
     $forumObj = $oForumObjects['forumObj'];
     /**
      * @var $frm ilForum
      */
     $frm = $oForumObjects['frm'];
     /**
      * @var $file_obj ilFileDataForum
      */
     $file_obj = $oForumObjects['file_obj'];
     // download file
     if ($_GET['file']) {
         if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) {
             ilUtil::sendFailure($this->lng->txt('error_reading_file'));
         } else {
             ilUtil::deliverFile($path['path'], $path['clean_filename']);
         }
     }
     if (!$this->objCurrentTopic->getId()) {
         $ilCtrl->redirect($this, 'showThreads');
     }
     // Set context for login
     $append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : '');
     $tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append);
     // delete temporary media object (not in case a user adds media objects and wants to save an invalid form)
     if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') {
         try {
             include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
             $mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
             foreach ($mobs as $mob) {
                 if (ilObjMediaObject::_exists($mob)) {
                     ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
                     $mob_obj = new ilObjMediaObject($mob);
                     $mob_obj->delete();
                 }
             }
         } catch (Exception $e) {
         }
     }
     require_once './Modules/Forum/classes/class.ilObjForum.php';
     require_once './Modules/Forum/classes/class.ilFileDataForum.php';
     $lng->loadLanguageModule('forum');
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
         $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm');
     }
     // save last access
     $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
     $this->prepareThreadScreen($forumObj);
     $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum');
     if (isset($_GET['anchor'])) {
         $tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']);
     }
     if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) {
         $orderField = 'frm_posts_tree.fpt_date';
         $this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC');
     } else {
         $orderField = 'frm_posts_tree.rgt';
         $this->objCurrentTopic->setOrderDirection('DESC');
     }
     // get forum- and thread-data
     $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
     if (is_array($topicData = $frm->getOneTopic())) {
         // Visit-Counter for topic
         $this->objCurrentTopic->updateVisits();
         $tpl->setTitle($lng->txt('forums_thread') . " \"" . $this->objCurrentTopic->getSubject() . "\"");
         // ********************************************************************************
         // build location-links
         $ilLocator->addRepositoryItems();
         $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ""), "_top");
         $tpl->setLocator();
         // set tabs
         // menu template (contains linkbar)
         /** @var $menutpl ilTemplate */
         $menutpl = new ilTemplate('tpl.forums_threads_menu.html', true, true, 'Modules/Forum');
         include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php";
         // mark all as read
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId())) {
             $this->ctrl->setParameter($this, 'mark_read', '1');
             $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
             $ilToolbar->addButton($this->lng->txt('forums_mark_read'), $this->ctrl->getLinkTarget($this, 'viewThread'), '', ilAccessKey::MARK_ALL_READ);
             $this->ctrl->clearParameters($this);
         }
         // print thread
         $this->ctrl->setParameterByClass('ilforumexportgui', 'print_thread', $this->objCurrentTopic->getId());
         $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_top_fk', $this->objCurrentTopic->getForumId());
         $ilToolbar->addButton($this->lng->txt('forums_print_thread'), $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printThread'));
         $this->ctrl->clearParametersByClass('ilforumexportgui');
         $this->addHeaderAction();
         if ($_GET['mark_read']) {
             $forumObj->markThreadRead($ilUser->getId(), (int) $this->objCurrentTopic->getId());
             ilUtil::sendInfo($lng->txt('forums_thread_marked'), true);
         }
         // delete post and its sub-posts
         require_once './Modules/Forum/classes/class.ilForum.php';
         if ($_GET['action'] == 'ready_delete' && $_POST['confirm'] != '') {
             if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
                 $frm = new ilForum();
                 $frm->setForumId($forumObj->getId());
                 $frm->setForumRefId($forumObj->getRefId());
                 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
                 // if complete thread was deleted ...
                 if ($dead_thr == $this->objCurrentTopic->getId()) {
                     $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($forumObj->getId()));
                     $topicData = $frm->getOneTopic();
                     ilUtil::sendInfo($lng->txt('forums_post_deleted'), true);
                     if ($topicData['top_num_threads'] > 0) {
                         $this->ctrl->redirect($this, 'showThreads');
                     } else {
                         $this->ctrl->redirect($this, 'createThread');
                     }
                 }
                 ilUtil::sendInfo($lng->txt('forums_post_deleted'));
             }
         }
         // form processing (censor)
         if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'ready_censor') {
             if (($_POST['confirm'] != '' || $_POST['no_cs_change'] != '') && $_GET['action'] == 'ready_censor') {
                 $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId(), 1);
             } else {
                 if (($_POST['cancel'] != '' || $_POST['yes_cs_change'] != '') && $_GET['action'] == 'ready_censor') {
                     $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId());
                 }
             }
         }
         // get complete tree of thread
         $first_node = $this->objCurrentTopic->getFirstPostNode();
         $this->objCurrentTopic->setOrderField($orderField);
         $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
         // no posts
         if (!($posNum = count($subtree_nodes))) {
             ilUtil::sendInfo($this->lng->txt('forums_no_posts_available'));
         }
         $pageHits = $frm->getPageHits();
         $z = 0;
         // navigation to browse
         if ($posNum > $pageHits) {
             $params = array('ref_id' => $_GET['ref_id'], 'thr_pk' => $this->objCurrentTopic->getId(), 'orderby' => $_GET['orderby']);
             if (!$_GET['offset']) {
                 $Start = 0;
             } else {
                 $Start = $_GET['offset'];
             }
             $linkbar = ilUtil::Linkbar($ilCtrl->getLinkTarget($this, 'viewThread'), $posNum, $pageHits, $Start, $params);
             if ($linkbar != '') {
                 $menutpl->setCurrentBlock('linkbar');
                 $menutpl->setVariable('LINKBAR', $linkbar);
                 $menutpl->parseCurrentBlock();
             }
         }
         $tpl->setVariable('THREAD_MENU', $menutpl->get());
         // assistance val for anchor-links
         $jump = 0;
         // generate post-dates
         foreach ($subtree_nodes as $node) {
             /**
              * @var $node ilForumPost 
              */
             $this->ctrl->clearParameters($this);
             if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) {
                 $jump++;
             }
             if ($posNum > $pageHits && $z >= $Start + $pageHits) {
                 // if anchor-link was not found ...
                 if ($this->objCurrentPost->getId() && $jump < 1) {
                     $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
                     $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                     $this->ctrl->setParameter($this, 'offset', $Start + $pageHits);
                     $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                     $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId());
                     exit;
                 } else {
                     break;
                 }
             }
             if ($posNum > $pageHits && $z >= $Start || $posNum <= $pageHits) {
                 if ($this->objCurrentPost->getId() == $node->getId()) {
                     # actions for "active" post
                     if ($this->is_moderator || $node->isActivated()) {
                         // reply/edit
                         if (!$this->objCurrentTopic->isClosed() && ($_GET['action'] == 'showreply' || $_GET['action'] == 'showedit')) {
                             if ($_GET['action'] == 'showedit' && (!$this->is_moderator && !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID || $node->isCensored())) {
                                 $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
                             } else {
                                 if ($_GET['action'] == 'showreply' && !$ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id'])) {
                                     $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
                                 }
                             }
                             $tpl->setVariable('REPLY_ANKER', $this->objCurrentPost->getId());
                             $oEditReplyForm = $this->getReplyEditForm();
                             switch ($this->objProperties->getSubjectSetting()) {
                                 case 'add_re_to_subject':
                                     $subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
                                     break;
                                 case 'preset_subject':
                                     $subject = $this->objCurrentPost->getSubject();
                                     break;
                                 case 'empty_subject':
                                 default:
                                     $subject = NULL;
                                     break;
                             }
                             switch ($_GET['action']) {
                                 case 'showreply':
                                     if ($this->ctrl->getCmd() == 'savePost') {
                                         $oEditReplyForm->setValuesByPost();
                                     } else {
                                         if ($this->ctrl->getCmd() == 'quotePost') {
                                             require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                                             $authorinfo = new ilForumAuthorInformation($node->getUserId(), $node->getUserAlias(), $node->getImportName());
                                             $oEditReplyForm->setValuesByPost();
                                             $oEditReplyForm->getItemByPostVar('message')->setValue(ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()) . "\n" . $oEditReplyForm->getInput('message'), 1));
                                         } else {
                                             $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $subject, 'message' => '', 'notify' => 0, 'userfile' => '', 'del_file' => array()));
                                         }
                                     }
                                     $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                                     $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
                                     $jsTpl = new ilTemplate('tpl.forum_post_quoation_ajax_handler.html', true, true, 'Modules/Forum/');
                                     $jsTpl->setVariable('IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this, 'getQuotationHTMLAsynch', '', true));
                                     $this->ctrl->clearParameters($this);
                                     $this->tpl->setVariable('FORM_ADDITIONAL_JS', $jsTpl->get());
                                     break;
                                 case 'showedit':
                                     if ($this->ctrl->getCmd() == 'savePost') {
                                         $oEditReplyForm->setValuesByPost();
                                     } else {
                                         $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $this->objCurrentPost->getSubject(), 'message' => ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($this->objCurrentPost->getMessage(), 2), 1), 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true : false, 'userfile' => '', 'del_file' => array()));
                                     }
                                     break;
                             }
                             $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'action', $_GET['action']);
                             $tpl->setVariable('FORM', $oEditReplyForm->getHTML());
                             $this->ctrl->clearParameters($this);
                         } else {
                             if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'delete') {
                                 if ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies() && $ilUser->getId() != ANONYMOUS_USER_ID) {
                                     // confirmation: delete
                                     $tpl->setVariable('FORM', $this->getDeleteFormHTML());
                                 }
                             } else {
                                 if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'censor') {
                                     if ($this->is_moderator) {
                                         // confirmation: censor / remove censorship
                                         $tpl->setVariable('FORM', $this->getCensorshipFormHTML());
                                     }
                                 } else {
                                     if (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) {
                                         if ($this->is_moderator) {
                                             // confirmation: activate
                                             $tpl->setVariable('FORM', $this->getActivationFormHTML());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 // if ($this->objCurrentPost->getId() == $node->getId())
                 if ($this->objCurrentPost->getId() != $node->getId() || $_GET['action'] != 'showreply' && $_GET['action'] != 'showedit' && $_GET['action'] != 'censor' && $_GET['action'] != 'delete' && !$this->displayConfirmPostActivation()) {
                     if ($this->is_moderator || $node->isActivated()) {
                         // button: reply
                         if (!$this->objCurrentTopic->isClosed() && $ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id']) && !$node->isCensored()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'showreply');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('reply'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: edit article
                         if (!$this->objCurrentTopic->isClosed() && ($node->isOwner($ilUser->getId()) || $this->is_moderator) && !$node->isCensored() && $ilUser->getId() != ANONYMOUS_USER_ID) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'showedit');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('edit'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: print
                         if (!$node->isCensored()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost'));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('print'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         # buttons for every post except the "active"
                         if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
                             // button: delete
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'delete');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('delete'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
                             // button: censor
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'censor');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('censorship'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                             // button: activation/deactivation
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             if (!$node->isActivated()) {
                                 $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId()));
                                 $tpl->setVariable('COMMANDS_TXT', $lng->txt('activate_post'));
                             }
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: mark read
                         if ($ilUser->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('is_read'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: mark unread
                         if ($ilUser->getId() != ANONYMOUS_USER_ID && $node->isPostRead()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('unread'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                     }
                 }
                 // if ($this->objCurrentPost->getId() != $node->getId())
                 // download post attachments
                 $tmp_file_obj = new ilFileDataForum($forumObj->getId(), $node->getId());
                 if (count($tmp_file_obj->getFilesOfPost())) {
                     if ($node->getId() != $this->objCurrentPost->getId() || $_GET['action'] != 'showedit') {
                         foreach ($tmp_file_obj->getFilesOfPost() as $file) {
                             $tpl->setCurrentBlock('attachment_download_row');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'file', $file['md5']);
                             $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
                             $tpl->setVariable('TXT_FILENAME', $file['name']);
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         $tpl->setCurrentBlock('attachments');
                         $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $lng->txt('forums_attachments'));
                         $tpl->setVariable('DOWNLOAD_IMG', ilUtil::getImagePath('icon_attachment.png'));
                         $tpl->setVariable('TXT_DOWNLOAD_ATTACHMENT', $lng->txt('forums_download_attachment'));
                         $tpl->parseCurrentBlock();
                     }
                 }
                 $tpl->setCurrentBlock('posts_row');
                 // anker for every post
                 $tpl->setVariable('POST_ANKER', $node->getId());
                 //permanent link for every post
                 //	$tpl->setVariable('PERMA_LINK', ILIAS_HTTP_PATH."/goto.php?target="."frm"."_".$this->object->getRefId()."_".$node->getThreadId()."_".$node->getId()."&client_id=".CLIENT_ID);
                 $tpl->setVariable('TXT_PERMA_LINK', $lng->txt('perma_link'));
                 $tpl->setVariable('PERMA_TARGET', '_top');
                 if ($this->objProperties->getMarkModeratorPosts() == 1) {
                     $is_moderator = ilForum::_isModerator($_GET['ref_id'], $node->getUserId());
                     if ($is_moderator) {
                         $rowCol = 'ilHighlighted';
                     } else {
                         $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
                     }
                 } else {
                     $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
                 }
                 if ($_GET['action'] != 'delete' && $_GET['action'] != 'censor' && !$this->displayConfirmPostActivation() || $this->objCurrentPost->getId() != $node->getId()) {
                     $tpl->setVariable('ROWCOL', ' ' . $rowCol);
                 } else {
                     // highlight censored posts
                     $rowCol = 'tblrowmarked';
                 }
                 // post is censored
                 if ($node->isCensored()) {
                     // display censorship advice
                     if ($_GET['action'] != 'censor') {
                         $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator'));
                     }
                     // highlight censored posts
                     $rowCol = 'tblrowmarked';
                 }
                 // set row color
                 $tpl->setVariable('ROWCOL', ' ' . $rowCol);
                 // if post is not activated display message for the owner
                 if (!$node->isActivated() && $node->isOwner($ilUser->getId())) {
                     $tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet'));
                 }
                 // Author
                 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                 $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                 $this->ctrl->clearParameters($this);
                 $this->ctrl->setParameter($this, 'backurl', $backurl);
                 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                 $this->ctrl->setParameter($this, 'user', $node->getUserId());
                 require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                 $authorinfo = new ilForumAuthorInformation($node->getUserId(), $node->getUserAlias(), $node->getImportName(), array('href' => $this->ctrl->getLinkTarget($this, 'showUser')));
                 $this->ctrl->clearParameters($this);
                 $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
                 if ($authorinfo->getAuthorName(true)) {
                     $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
                 }
                 $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
                 if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $authorinfo->getAuthor()->getId())) {
                     if ($authorinfo->getAuthor()->getGender() == 'f') {
                         $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f'));
                     } else {
                         if ($authorinfo->getAuthor()->getGender() == 'm') {
                             $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m'));
                         }
                     }
                 }
                 // get create- and update-dates
                 if ($node->getUpdateUserId() > 0) {
                     $spanClass = '';
                     // last update from moderator?
                     $posMod = $frm->getModeratorFromPost($node->getId());
                     if (is_array($posMod) && $posMod['top_mods'] > 0) {
                         $MODS = $rbacreview->assignedUsers($posMod['top_mods']);
                         if (is_array($MODS)) {
                             if (in_array($node->getUpdateUserId(), $MODS)) {
                                 $spanClass = 'moderator_small';
                             }
                         }
                     }
                     $node->setChangeDate($node->getChangeDate());
                     if ($spanClass == '') {
                         $spanClass = 'small';
                     }
                     $this->ctrl->setParameter($this, 'backurl', $backurl);
                     $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                     $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId());
                     require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                     $authorinfo = new ilForumAuthorInformation($node->getUpdateUserId(), '', '', array('href' => $this->ctrl->getLinkTarget($this, 'showUser')));
                     $this->ctrl->clearParameters($this);
                     $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($lng->txt('by')));
                     $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
                     if ($authorinfo->getAuthorName(true)) {
                         $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
                     }
                 }
                 // if ($node->getUpdateUserId() > 0)*/
                 // Author end
                 // prepare post
                 $node->setMessage($frm->prepareText($node->getMessage()));
                 if ($ilUser->getId() == ANONYMOUS_USER_ID || $node->isPostRead()) {
                     $tpl->setVariable('SUBJECT', $node->getSubject());
                 } else {
                     $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                     $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                     $this->ctrl->setParameter($this, 'offset', $Start);
                     $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                     $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                     $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
                     $tpl->setVariable('SUBJECT', "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>");
                 }
                 $tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate()));
                 $tpl->setVariable('SPACER', "<hr noshade width=100% size=1 align='center' />");
                 if (!$node->isCensored() || $this->objCurrentPost->getId() == $node->getId() && $_GET['action'] == 'censor') {
                     // post from moderator?
                     $modAuthor = $frm->getModeratorFromPost($node->getId());
                     $spanClass = "";
                     if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) {
                         unset($MODS);
                         $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']);
                         if (is_array($MODS)) {
                             if (in_array($node->getUserId(), $MODS)) {
                                 $spanClass = 'moderator';
                             }
                         }
                     }
                     /** @todo mjansen: possible bugfix for mantis #8223 */
                     if ($node->getMessage() == strip_tags($node->getMessage())) {
                         // We can be sure, that there are not html tags
                         $node->setMessage(nl2br($node->getMessage()));
                     }
                     if ($spanClass != "") {
                         $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1) . "</span>");
                     } else {
                         $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1));
                     }
                 } else {
                     $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>");
                 }
                 $tpl->parseCurrentBlock();
             }
             $z++;
         }
     } else {
         $tpl->setCurrentBlock('posts_no');
         $tpl->setVariable('TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt('forums_posts_not_available'));
         $tpl->parseCurrentBlock();
     }
     $oThreadToolbar = clone $ilToolbar;
     $oThreadToolbar->addSeparator();
     $oThreadToolbar->addButton($this->lng->txt('top_of_page'), '#frm_page_top');
     $tpl->setVariable('THREAD_TOOLBAR', $oThreadToolbar->getHTML());
     $tpl->setVariable('TPLPATH', $tpl->vars['TPLPATH']);
     // permanent link
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId(), '_' . $this->objCurrentTopic->getId());
     $this->tpl->setVariable('PRMLINK', $permalink->getHTML());
     // Render tree
     if ($_SESSION['viewmode'] == 'answers' || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
         $tpl->setLeftNavContent($this->getForumExplorer());
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * @param ilTemplate $tpl
  * @param ilForumPost $post
  * @param int $counter
  * @param int $mode
  */
 protected function renderPostHtml(ilTemplate $tpl, ilForumPost $post, $counter, $mode)
 {
     /**
      * @var $lng            ilLanguage
      * @var $rbacreview     ilRbacReview
      * @var $ilUser         ilObjUser
      * @var $ilObjDataCache ilObjectDataCache
      */
     global $lng, $rbacreview, $ilUser, $ilObjDataCache;
     $tpl->setCurrentBlock('posts_row');
     if (ilForumProperties::getInstance($ilObjDataCache->lookupObjId($_GET['ref_id']))->getMarkModeratorPosts() == 1) {
         if ($post->getIsAuthorModerator() === null && ($is_moderator = ilForum::_isModerator($_GET['ref_id'], $post->getPosAuthorId()))) {
             $rowCol = 'ilModeratorPosting';
         } else {
             if ($post->getIsAuthorModerator()) {
                 $rowCol = 'ilModeratorPosting';
             } else {
                 $rowCol = ilUtil::switchColor($counter, 'tblrow1', 'tblrow2');
             }
         }
     } else {
         $rowCol = ilUtil::switchColor($counter, 'tblrow1', 'tblrow2');
     }
     $tpl->setVariable('ROWCOL', ' ' . $rowCol);
     // post is censored
     if ($post->isCensored()) {
         // display censorship advice
         $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $lng->txt('post_censored_comment_by_moderator'));
         // highlight censored posts
         $rowCol = 'tblrowmarked';
     }
     // set row color
     $tpl->setVariable('ROWCOL', ' ' . $rowCol);
     // if post is not activated display message for the owner
     if (!$post->isActivated() && $post->isOwner($ilUser->getId())) {
         $tpl->setVariable('POST_NOT_ACTIVATED_YET', $lng->txt('frm_post_not_activated_yet'));
     }
     $authorinfo = new ilForumAuthorInformation($post->getPosAuthorId(), $post->getDisplayUserId(), $post->getUserAlias(), $post->getImportName());
     if ($authorinfo->hasSuffix()) {
         $tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
         $tpl->setVariable('USR_NAME', $post->getUserAlias());
     } else {
         $tpl->setVariable('AUTHOR', $authorinfo->getAuthorShortName());
         if ($authorinfo->getAuthorName(true)) {
             $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
         }
     }
     if (self::MODE_EXPORT_CLIENT == $mode) {
         if ($authorinfo->getAuthor()->getPref('public_profile') != 'n') {
             $tpl->setVariable('TXT_REGISTERED', $lng->txt('registered_since'));
             $tpl->setVariable('REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
         }
         if ($post->getDisplayUserId()) {
             if ($this->is_moderator) {
                 $num_posts = $this->frm->countUserArticles($post->getDisplayUserId());
             } else {
                 $num_posts = $this->frm->countActiveUserArticles($post->getDisplayUserId());
             }
             $tpl->setVariable('TXT_NUM_POSTS', $lng->txt('forums_posts'));
             $tpl->setVariable('NUM_POSTS', $num_posts);
         }
     }
     $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
     if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $post->getPosAuthorId())) {
         if ($authorinfo->getAuthor()->getGender() == 'f') {
             $tpl->setVariable('ROLE', $lng->txt('frm_moderator_f'));
         } else {
             if ($authorinfo->getAuthor()->getGender() == 'm') {
                 $tpl->setVariable('ROLE', $lng->txt('frm_moderator_m'));
             }
         }
     }
     // get create- and update-dates
     if ($post->getUpdateUserId() > 0) {
         $spanClass = '';
         // last update from moderator?
         $posMod = $this->frm->getModeratorFromPost($post->getId());
         if (is_array($posMod) && $posMod['top_mods'] > 0) {
             $MODS = $rbacreview->assignedUsers($posMod['top_mods']);
             if (is_array($MODS)) {
                 if (in_array($post->getUpdateUserId(), $MODS)) {
                     $spanClass = 'moderator_small';
                 }
             }
         }
         $post->setChangeDate($post->getChangeDate());
         if ($spanClass == '') {
             $spanClass = 'small';
         }
         require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
         $authorinfo = new ilForumAuthorInformation($post->getPosAuthorId(), $post->getUpdateUserId(), '', '');
         $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $this->frm->convertDate($post->getChangeDate()) . ' - ' . strtolower($lng->txt('by')));
         $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
         if ($authorinfo->getAuthorName(true)) {
             $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
         }
     }
     // prepare post
     $post->setMessage($this->frm->prepareText($post->getMessage()));
     $tpl->setVariable('POST_DATE', $this->frm->convertDate($post->getCreateDate()));
     $tpl->setVariable('SUBJECT', $post->getSubject());
     if (!$post->isCensored()) {
         // post from moderator?
         $modAuthor = $this->frm->getModeratorFromPost($post->getId());
         $spanClass = "";
         if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) {
             $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']);
             if (is_array($MODS) && in_array($post->getDisplayUserId(), $MODS)) {
                 $spanClass = 'moderator';
             }
         }
         // possible bugfix for mantis #8223
         if ($post->getMessage() == strip_tags($post->getMessage())) {
             // We can be sure, that there are not html tags
             $post->setMessage(nl2br($post->getMessage()));
         }
         if ($spanClass != "") {
             $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($post->getMessage(), 1) . "</span>");
         } else {
             $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($post->getMessage(), 1));
         }
     } else {
         $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($post->getCensorshipComment()) . "</span>");
     }
     $tpl->parseCurrentBlock('posts_row');
 }