/**
  * @return array
  */
 public function getProperties()
 {
     /**
      * @var $lng	  ilLanguage
      * @var $ilUser   ilObjUser
      * @var $ilAccess ilAccessHandler
      */
     global $lng, $ilUser, $ilAccess;
     if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
         return array();
     }
     $lng->loadLanguageModule('forum');
     $props = array();
     include_once 'Modules/Forum/classes/class.ilObjForumAccess.php';
     $properties = ilObjForumAccess::getStatisticsByRefId($this->ref_id);
     $num_posts_total = $properties['num_posts'];
     $num_unread_total = $properties['num_unread_posts'];
     $num_new_total = $properties['num_new_posts'];
     $last_post = ilObjForumAccess::getLastPostByRefId($this->ref_id);
     if (!$ilUser->isAnonymous()) {
         if ($this->getDetailsLevel() == ilObjectListGUI::DETAILS_ALL) {
             $alert = $num_unread_total > 0 ? true : false;
             $props[] = array('alert' => $alert, 'property' => $lng->txt('forums_articles') . ' (' . $lng->txt('unread') . ')', 'value' => $num_posts_total . ' (' . $num_unread_total . ')');
             // New
             $alert = $num_new_total > 0 ? true : false;
             $props[] = array('alert' => $alert, 'property' => $lng->txt('forums_new_articles'), 'value' => $num_new_total);
         }
     } else {
         $props[] = array('alert' => false, 'property' => $lng->txt('forums_articles'), 'value' => $num_posts_total);
     }
     include_once 'Modules/Forum/classes/class.ilForumProperties.php';
     if ($this->getDetailsLevel() == ilObjectListGUI::DETAILS_ALL) {
         if (ilForumProperties::getInstance($this->obj_id)->isAnonymized()) {
             $props[] = array('alert' => false, 'newline' => false, 'property' => $lng->txt('forums_anonymized'), 'value' => $lng->txt('yes'));
         }
     }
     // Last Post
     if ((int) $last_post['pos_pk']) {
         $lpCont = "<a class=\"il_ItemProperty\" target=\"" . ilFrameTargetInfo::_getFrame('MainContent') . "\" href=\"ilias.php?baseClass=ilRepositoryGUI&amp;cmd=viewThread&amp;cmdClass=ilobjforumgui&amp;target=true&amp;pos_pk=" . $last_post['pos_pk'] . "&amp;thr_pk=" . $last_post['pos_thr_fk'] . "&amp;ref_id=" . $this->ref_id . "#" . $last_post["pos_pk"] . "\">" . ilObjForumAccess::prepareMessageForLists($last_post['pos_message']) . "</a> " . strtolower($lng->txt('from')) . "&nbsp;";
         require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
         $authorinfo = new ilForumAuthorInformation($last_post['pos_usr_id'], $last_post['pos_usr_alias'], $last_post['import_name'], array('class' => 'il_ItemProperty', 'href' => 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=showUser&amp;cmdClass=ilobjforumgui&amp;ref_id=' . $this->ref_id . '&amp;user='******'pos_usr_id'] . '&amp;offset=0&amp;backurl=' . urlencode('ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=' . $_GET['ref_id'])));
         $lpCont .= $authorinfo->getLinkedAuthorName();
         $lpCont .= ', ' . ilDatePresentation::formatDate(new ilDateTime($last_post['pos_date'], IL_CAL_DATETIME));
         $props[] = array('alert' => false, 'newline' => true, 'property' => $lng->txt('forums_last_post'), 'value' => $lpCont);
     }
     return $props;
 }
    public function getNestedSetPostChildren($pos_id = null, $expandedNodes = array())
    {
        global $ilUser;
        $data = null;
        $objProperties = ilForumProperties::getInstance($this->getFrmObjId());
        $is_post_activation_enabled = $objProperties->isPostActivationEnabled();
        if ($pos_id !== null) {
            $res = $this->db->queryF("\n\t\t\t\tSELECT\t\tlft, rgt\n\t\t\t\tFROM\t\tfrm_posts_tree\n\t\t\t\tWHERE\t\tpos_fk = %s\n\t\t\t\tAND\t\t\tthr_fk = %s", array('integer', 'integer'), array($pos_id, $this->id));
            $data = $this->db->fetchAssoc($res);
        }
        $query = '
			SELECT			fpt.depth,
							fpt.rgt,
							fpt.parent_pos,
							fp.pos_pk,
							fp.pos_subject,
							fp.pos_usr_alias,
							fp.pos_date,
							fp.pos_update,
							fp.pos_status,
							fp.pos_display_user_id,
							fp.pos_usr_alias,
							fp.import_name,
							fp.pos_author_id,
							fp.is_author_moderator,
							fur.post_id,
							(CASE
							WHEN fur.post_id IS NULL ' . ($ilUser->getId() == ANONYMOUS_USER_ID ? ' AND 1 = 2 ' : '') . '
							THEN 0
							ELSE 1
							END) post_read,
							COUNT(fpt2.pos_fk) children	

			FROM			frm_posts_tree fpt

			INNER JOIN		frm_posts fp
				ON			fp.pos_pk = fpt.pos_fk
				
			LEFT JOIN		frm_posts_tree fpt2
				 ON         fpt2.lft BETWEEN fpt.lft AND fpt.rgt
				 AND		fpt.thr_fk = fpt2.thr_fk
				 AND		fpt.pos_fk != fpt2.pos_fk ';
        $query .= '
			LEFT JOIN		frm_user_read fur
				ON			fur.thread_id = fp.pos_thr_fk
				AND			fur.post_id = fp.pos_pk
				AND			fur.usr_id = ' . $this->db->quote($ilUser->getId(), 'integer') . '

			LEFT JOIN		usr_data ud
				ON			ud.usr_id = fp.pos_display_user_id
		
			WHERE			fpt.thr_fk = ' . $this->db->quote($this->id, 'integer');
        if ($data) {
            $query .= '		AND fpt.lft > ' . $this->db->quote($data['lft'], 'integer') . '		AND fpt.lft < ' . $this->db->quote($data['rgt'], 'integer') . ' ';
        }
        if ($is_post_activation_enabled && !$this->is_moderator) {
            $query .= ' AND (fp.pos_status = 1 OR fp.pos_status = 0 AND fp.pos_display_user_id = ' . $this->db->quote($ilUser->getId(), 'integer') . ') ';
        }
        if ($expandedNodes) {
            $query .= ' AND ' . $this->db->in('fpt.parent_pos', $expandedNodes, false, 'integer') . ' ';
        }
        $query .= ' GROUP BY fpt.depth,
							fpt.rgt,
							fpt.parent_pos,
							fp.pos_pk,
							fp.pos_subject,
							fp.pos_usr_alias,
							fp.pos_date,
							fp.pos_update,
							fp.pos_status,
							fp.pos_display_user_id,
							fp.pos_usr_alias,
							fp.import_name,
							fp.pos_author_id,
							fp.is_author_moderator,
							fur.post_id
					ORDER BY fpt.rgt DESC
		';
        $queryCounter = '
			SELECT			pos_fk
			FROM			frm_posts_tree fpt
			INNER JOIN		frm_posts fp
				ON			fp.pos_pk = fpt.pos_fk
			WHERE			fpt.thr_fk = ' . $this->db->quote($this->id, 'integer');
        if ($is_post_activation_enabled && !$this->is_moderator) {
            $queryCounter .= ' AND (fp.pos_status = 1 OR fp.pos_status = 0 AND fp.pos_display_user_id = ' . $this->db->quote($ilUser->getId(), 'integer') . ') ';
        }
        $queryCounter .= ' ORDER BY fpt.rgt DESC';
        $resCounter = $this->db->query($queryCounter);
        $counter = array();
        $i = 0;
        while ($row = $this->db->fetchAssoc($resCounter)) {
            $counter[$row['pos_fk']] = $i++;
        }
        $res = $this->db->query($query);
        $children = array();
        $usr_ids = array();
        while ($row = $this->db->fetchAssoc($res)) {
            if ((int) $row['pos_display_user_id']) {
                $usr_ids[] = (int) $row['pos_display_user_id'];
            }
            $row['counter'] = $counter[$row['pos_pk']];
            $children[] = $row;
        }
        require_once 'Modules/Forum/classes/class.ilForumAuthorInformationCache.php';
        ilForumAuthorInformationCache::preloadUserObjects(array_unique($usr_ids));
        return $children;
    }
 /**
  * Clone Object
  * @param int $a_target_id
  * @param int $a_copy_id
  * @return object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     /**
      * @var $ilDB ilDB
      */
     global $ilDB;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneAutoGeneratedRoles($new_obj);
     ilForumProperties::getInstance($this->getId())->copy($new_obj->getId());
     $this->Forum->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($this->getId()));
     $topData = $this->Forum->getOneTopic();
     $nextId = $ilDB->nextId('frm_data');
     $statement = $ilDB->insert('frm_data', array('top_pk' => array('integer', $nextId), 'top_frm_fk' => array('integer', $new_obj->getId()), 'top_name' => array('text', $topData['top_name']), 'top_description' => array('text', $topData['top_description']), 'top_num_posts' => array('integer', $topData['top_num_posts']), 'top_num_threads' => array('integer', $topData['top_num_threads']), 'top_last_post' => array('text', $topData['top_last_post']), 'top_mods' => array('integer', !is_numeric($topData['top_mods']) ? 0 : $topData['top_mods']), 'top_date' => array('timestamp', $topData['top_date']), 'visits' => array('integer', $topData['visits']), 'top_update' => array('timestamp', $topData['top_update']), 'update_user' => array('integer', $topData['update_user']), 'top_usr_id' => array('integer', $topData['top_usr_id'])));
     // read options
     include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
     $options = $cwo->getOptions($this->getRefId());
     $options['threads'] = $this->Forum->_getThreads($this->getId());
     // Generate starting threads
     include_once 'Modules/Forum/classes/class.ilFileDataForum.php';
     $new_frm = $new_obj->Forum;
     $new_frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($new_obj->getId()));
     $new_frm->setForumId($new_obj->getId());
     $new_frm->setForumRefId($new_obj->getRefId());
     $new_topic = $new_frm->getOneTopic();
     foreach ($options['threads'] as $thread_id => $thread_subject) {
         $this->Forum->setMDB2WhereCondition('thr_pk = %s ', array('integer'), array($thread_id));
         $old_thread = $this->Forum->getOneThread();
         $old_post_id = $this->Forum->getFirstPostByThread($old_thread['thr_pk']);
         $old_post = $this->Forum->getOnePost($old_post_id);
         // Now create new thread and first post
         $new_post = $new_frm->generateThread($new_topic['top_pk'], $old_thread['thr_usr_id'], $old_thread['thr_subject'], ilForum::_lookupPostMessage($old_post_id), $old_post['notify'], 0, $old_thread['thr_usr_alias'], $old_thread['thr_date']);
         // Copy attachments
         $old_forum_files = new ilFileDataForum($this->getId(), $old_post_id);
         $old_forum_files->ilClone($new_obj->getId(), $new_post);
     }
     return $new_obj;
 }
Beispiel #4
0
 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
 {
     /**
      * @var $ilCtrl ilCtrl
      * @var $ilAccess ilAccessHandler
      * @var $ilObjDataCache ilObjectDataCache
      */
     global $ilCtrl, $ilAccess, $ilObjDataCache;
     $this->ctrl = $ilCtrl;
     $this->ctrl->saveParameter($this, array('ref_id', 'cmdClass'));
     $this->type = 'frm';
     parent::__construct($a_data, $a_id, $a_call_by_reference, false);
     $this->lng->loadLanguageModule('forum');
     $this->initSessionStorage();
     // Forum properties
     $this->objProperties = ilForumProperties::getInstance($ilObjDataCache->lookupObjId($_GET['ref_id']));
     // Stored due to performance issues
     $this->is_moderator = $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id']);
     // Model of current topic/thread
     $this->objCurrentTopic = new ilForumTopic((int) $_GET['thr_pk'], $this->is_moderator);
     // Model of current post
     $this->objCurrentPost = new ilForumPost((int) $_GET['pos_pk'], $this->is_moderator);
     $frma_set = new ilSetting('frma');
     $this->forum_overview_setting = $frma_set->get('forum_overview');
 }
 /**
  * handler for end of element
  *
  * @param	resource	$a_xml_parser		xml parser
  * @param	string		$a_name				element name
  */
 public function handlerEndTag($a_xml_parser, $a_name)
 {
     global $ilDB, $ilUser;
     $this->cdata = trim($this->cdata);
     $arrayname = strtolower($this->entity) . 'Array';
     $x =& $this->{$arrayname};
     switch ($a_name) {
         case 'Forum':
             $query_num_posts = "SELECT COUNT(pos_pk) cnt\n\t\t\t\t\t\t\t\t\t\tFROM frm_posts\n\t\t\t\t\t\t\t\t\tWHERE pos_top_fk = " . $ilDB->quote($this->lastHandledForumId, 'integer');
             $res_pos = $ilDB->query($query_num_posts);
             $data_pos = $ilDB->fetchAssoc($res_pos);
             $num_posts = $data_pos['cnt'];
             $query_num_threads = "SELECT COUNT(thr_pk) cnt\n\t\t\t\t\t\t\t\t\t\tFROM frm_threads\n\t\t\t\t\t\t\t\t\t  WHERE thr_top_fk = " . $ilDB->quote($this->lastHandledForumId, 'integer');
             $res_thr = $ilDB->query($query_num_threads);
             $data_thr = $ilDB->fetchAssoc($res_thr);
             $num_threads = $data_thr['cnt'];
             $update_str = "{$this->lastHandledForumId}#{$this->lastHandledThreadId}#{$this->lastHandledPostId}";
             $ilDB->manipulateF("UPDATE frm_data \n\t\t\t\t\t\tSET top_last_post = %s,\n\t\t\t\t\t\t\ttop_num_posts = %s,\n\t\t\t\t\t\t\ttop_num_threads = %s\n\t\t\t\t\tWHERE top_frm_fk = %s", array('text', 'integer', 'integer', 'integer'), array($update_str, $num_posts, $num_threads, $this->forum_obj_id));
             break;
         case 'Id':
             $x['Id'] = $this->cdata;
             break;
         case 'ObjId':
             $x['ObjId'] = $this->cdata;
             break;
         case 'Title':
             $x['Title'] = $this->cdata;
             break;
         case 'Description':
             $x['Description'] = $this->cdata;
             break;
         case 'DefaultView':
             $x['DefaultView'] = $this->cdata;
             break;
         case 'Pseudonyms':
             $x['Pseudonyms'] = $this->cdata;
             break;
         case 'Statistics':
             $x['Statistics'] = $this->cdata;
             break;
         case 'PostingActivation':
             $x['PostingActivation'] = $this->cdata;
             break;
         case 'PresetSubject':
             $x['PresetSubject'] = $this->cdata;
             break;
         case 'PresetRe':
             $x['PresetRe'] = $this->cdata;
             break;
         case 'NotificationType':
             $x['NotificationType'] = $this->cdata;
             break;
         case 'ForceNotification':
             $x['ForceNotification'] = $this->cdata;
             break;
         case 'ToggleNotification':
             $x['ToggleNotification'] = $this->cdata;
             break;
         case 'LastPost':
             $x['LastPost'] = $this->cdata;
             break;
         case 'Moderator':
             $x['Moderator'] = $this->cdata;
             break;
         case 'CreateDate':
             $x['CreateDate'] = $this->cdata;
             break;
         case 'UpdateDate':
             $x['UpdateDate'] = $this->cdata;
             break;
         case 'UpdateUserId':
             $x['UpdateUserId'] = $this->cdata;
             break;
         case 'UserId':
             $x['UserId'] = $this->cdata;
             if ($this->entity == 'forum' && $this->forumArray) {
                 //// @todo: Maybe problems if the forum xml is imported as content of a course
                 // createSettings accesses superglobal $_GET  array, which can cause problems
                 // with public_notifications of block settings
                 $this->forum->createSettings();
                 $forum_array = $this->getUserIdAndAlias($this->forumArray['UserId'], '');
                 // Store old user id
                 $oldUsrId = $ilUser->getId();
                 // Manipulate user object
                 $ilUser->setId($forum_array['usr_id']);
                 // create frm_data
                 $this->forum->saveData(array());
                 // Restore old user id
                 $ilUser->setId($oldUsrId);
                 $update_forum_array = $this->getUserIdAndAlias($this->forumArray['UpdateUserId'], '');
                 // Store old user id
                 $oldUsrId = $_SESSION["AccountId"];
                 // Manipulate user object
                 $_SESSION["AccountId"] = $update_forum_array['usr_id'];
                 $this->forum->setTitle($this->forumArray["Title"]);
                 $this->forum->setDescription($this->forumArray["Description"]);
                 $this->forum->update();
                 // Restore old user id
                 $_SESSION["AccountId"] = $oldUsrId;
                 // create frm_settings
                 $newObjProp = ilForumProperties::getInstance($this->forum->getId());
                 $newObjProp->setDefaultView((int) $this->forumArray['DefaultView']);
                 $newObjProp->setAnonymisation((int) $this->forumArray['Pseudonyms']);
                 $newObjProp->setStatisticsStatus((int) $this->forumArray['Statistics']);
                 $newObjProp->setPostActivation((int) $this->forumArray['PostingActivation']);
                 $newObjProp->setPresetSubject((int) $this->forumArray['PresetSubject']);
                 $newObjProp->setAddReSubject((int) $this->forumArray['PresetRe']);
                 $newObjProp->setNotificationType($this->forumArray['NotificationType'] ? $this->forumArray['NotificationType'] : 'all_users');
                 $newObjProp->setAdminForceNoti((int) $this->forumArray['ForceNotification']);
                 $newObjProp->setUserToggleNoti((int) $this->forumArray['ToggleNotification']);
                 $newObjProp->insert();
                 $id = $this->getNewForumPk();
                 $this->forum_obj_id = $newObjProp->getObjId();
                 $this->mapping['frm'][$this->forumArray['Id']] = $id;
                 $this->lastHandledForumId = $id;
                 unset($this->forumArray);
             }
             break;
         case 'Thread':
             $update_str = "{$this->lastHandledForumId}#{$this->lastHandledThreadId}#{$this->lastHandledPostId}";
             $ilDB->manipulateF("UPDATE frm_threads\n\t\t\t\t\t\tSET thr_last_post = %s\n\t\t\t\t\tWHERE thr_pk = %s", array('text', 'integer'), array($update_str, $this->lastHandledThreadId));
             break;
         case 'Subject':
             $x['Subject'] = $this->cdata;
             break;
         case 'Alias':
             $x['Alias'] = $this->cdata;
             break;
         case 'Sticky':
             $x['Sticky'] = $this->cdata;
             break;
         case 'Closed':
             $x['Closed'] = $this->cdata;
             if ($this->entity == 'thread' && $this->threadArray) {
                 require_once 'Modules/Forum/classes/class.ilForumTopic.php';
                 $this->forumThread = new ilForumTopic();
                 $this->forumThread->setId($this->threadArray['Id']);
                 $this->forumThread->setForumId($this->lastHandledForumId);
                 $this->forumThread->setSubject($this->threadArray['Subject']);
                 $this->forumThread->setSticky($this->threadArray['Sticky']);
                 $this->forumThread->setClosed($this->threadArray['Closed']);
                 $this->forumThread->setCreateDate($this->threadArray['CreateDate']);
                 $this->forumThread->setChangeDate($this->threadArray['UpdateDate']);
                 $this->forumThread->setImportName($this->threadArray['ImportName']);
                 $usr_data = $this->getUserIdAndAlias($this->threadArray['UserId'], $this->threadArray['Alias']);
                 $this->forumThread->setUserId($usr_data['usr_id']);
                 $this->forumThread->setUserAlias($usr_data['usr_alias']);
                 $this->forumThread->insert();
                 $this->mapping['thr'][$this->threadArray['Id']] = $this->forumThread->getId();
                 $this->lastHandledThreadId = $this->forumThread->getId();
                 unset($this->threadArray);
             }
             break;
         case 'Post':
             break;
         case 'Censorship':
             $x['Censorship'] = $this->cdata;
             break;
         case 'CensorshipMessage':
             $x['CensorshipMessage'] = $this->cdata;
             break;
         case 'Notification':
             $x['Notification'] = $this->cdata;
             break;
         case 'ImportName':
             $x['ImportName'] = $this->cdata;
             break;
         case 'Status':
             $x['Status'] = $this->cdata;
             break;
         case 'Message':
             $x['Message'] = $this->cdata;
             break;
         case 'Lft':
             $x['Lft'] = $this->cdata;
             break;
         case 'Rgt':
             $x['Rgt'] = $this->cdata;
             break;
         case 'Depth':
             $x['Depth'] = $this->cdata;
             break;
         case 'ParentId':
             $x['ParentId'] = $this->cdata;
             if ($this->entity == 'post' && $this->postArray) {
                 require_once 'Modules/Forum/classes/class.ilForumPost.php';
                 $this->forumPost = new ilForumPost();
                 $this->forumPost->setId($this->postArray['Id']);
                 $this->forumPost->setCensorship($this->postArray['Censorship']);
                 $this->forumPost->setCensorshipComment($this->postArray['CensorshipMessage']);
                 $this->forumPost->setNotification($this->postArray['Notification']);
                 $this->forumPost->setImportName($this->postArray['ImportName']);
                 $this->forumPost->setStatus($this->postArray['Status']);
                 $this->forumPost->setMessage($this->postArray['Message']);
                 $this->forumPost->setSubject($this->postArray['Subject']);
                 $this->forumPost->setLft($this->postArray['Lft']);
                 $this->forumPost->setRgt($this->postArray['Rgt']);
                 $this->forumPost->setDepth($this->postArray['Depth']);
                 $this->forumPost->setParentId($this->postArray['ParentId']);
                 $this->forumPost->setThread($this->forumThread);
                 $this->forumPost->setThreadId($this->lastHandledThreadId);
                 $this->forumPost->setForumId($this->lastHandledForumId);
                 $this->forumPost->setCreateDate($this->postArray['CreateDate']);
                 $this->forumPost->setChangeDate($this->postArray['UpdateDate']);
                 $usr_data = $this->getUserIdAndAlias($this->postArray['UserId'], $this->postArray['Alias']);
                 $update_usr_data = $this->getUserIdAndAlias($this->postArray['UpdateUserId']);
                 $this->forumPost->setUserId($usr_data['usr_id']);
                 $this->forumPost->setUserAlias($usr_data['usr_alias']);
                 $this->forumPost->setUpdateUserId($update_usr_data['usr_id']);
                 $this->forumPost->insert();
                 if ($this->mapping['pos'][$this->postArray['ParentId']]) {
                     $parentId = $this->mapping['pos'][$this->postArray['ParentId']];
                 } else {
                     $parentId = 0;
                 }
                 $postTreeNodeId = $ilDB->nextId('frm_posts_tree');
                 $ilDB->insert('frm_posts_tree', array('fpt_pk' => array('integer', $postTreeNodeId), 'thr_fk' => array('integer', $this->lastHandledThreadId), 'pos_fk' => array('integer', $this->forumPost->getId()), 'parent_pos' => array('integer', $parentId), 'lft' => array('integer', $this->postArray['Lft']), 'rgt' => array('integer', $this->postArray['Rgt']), 'depth' => array('integer', $this->postArray['Depth']), 'fpt_date' => array('timestamp', date('Y-m-d H:i:s'))));
                 $this->mapping['pos'][$this->postArray['Id']] = $this->forumPost->getId();
                 $this->lastHandledPostId = $this->forumPost->getId();
                 $media_objects_found = false;
                 foreach ($this->mediaObjects as $mob_attr) {
                     $importfile = $this->getImportDirectory() . '/' . $mob_attr['uri'];
                     if (file_exists($importfile)) {
                         $mob = ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, false);
                         ilObjMediaObject::_saveUsage($mob->getId(), "frm:html", $this->forumPost->getId());
                         $this->forumPost->setMessage(str_replace(array("src=\"" . $mob_attr["label"] . "\"", "src=\"" . preg_replace("/(il)_[\\d]+_(mob)_([\\d]+)/", "\$1_0_\$2_\$3", $mob_attr["label"]) . "\""), "src=\"" . "il_" . IL_INST_ID . "_mob_" . $mob->getId() . "\"", $this->forumPost->getMessage()));
                         $media_objects_found = true;
                     }
                 }
                 if ($media_objects_found) {
                     $this->forumPost->update();
                 }
                 unset($this->postArray);
             }
             break;
         case 'Content':
             $x['content'] = $this->cdata;
             break;
         case 'Attachment':
             $filedata = new ilFileDataForum($this->forum->getId(), $this->lastHandledPostId);
             $importPath = $this->contentArray['content'];
             if (strlen($importPath)) {
                 $importPath = $this->getImportDirectory() . '/' . $importPath;
                 $newFilename = preg_replace("/^\\d+_\\d+(_.*)/ims", $this->forum->getId() . "_" . $this->lastHandledPostId . "\$1", basename($importPath));
                 $path = $filedata->getForumPath();
                 $newPath = $path . '/' . $newFilename;
                 @copy($importPath, $newPath);
             }
             break;
     }
     $this->cdata = '';
     return;
 }
Beispiel #6
0
 /**
  * @static
  * @param int $ref_id
  * @return array
  */
 public static function lookupStatisticsByRefId($ref_id)
 {
     /**
      * @var $ilAccess  ilAccessHandler
      * @var $ilUser    ilObjUser
      * @var $ilDB      ilDB
      * @var $ilSetting ilSetting
      */
     global $ilAccess, $ilUser, $ilDB, $ilSetting;
     if (isset(self::$forum_statistics_cache[$ref_id])) {
         return self::$forum_statistics_cache[$ref_id];
     }
     $statistics = array('num_posts' => 0, 'num_unread_posts' => 0, 'num_new_posts' => 0);
     $forumId = self::lookupForumIdByRefId($ref_id);
     if (!$forumId) {
         self::$forum_statistics_cache[$ref_id] = $statistics;
         return self::$forum_statistics_cache[$ref_id];
     }
     $objProperties = ilForumProperties::getInstance(ilObject::_lookupObjectId($ref_id));
     $is_post_activation_enabled = $objProperties->isPostActivationEnabled();
     $act_clause = '';
     if ($is_post_activation_enabled && !$ilAccess->checkAccess('moderate_frm', '', $ref_id)) {
         $act_clause .= " AND (frm_posts.pos_status = " . $ilDB->quote(1, "integer") . " OR frm_posts.pos_author_id = " . $ilDB->quote($ilUser->getId(), "integer") . ") ";
     }
     $new_deadline = date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 7 * ($ilSetting->get('frm_store_new') ? $ilSetting->get('frm_store_new') : 8));
     if (!$ilUser->isAnonymous()) {
         $query = "\n\t\t\t\t(SELECT COUNT(frm_posts.pos_pk) cnt\n\t\t\t\tFROM frm_posts\n\t\t\t\tINNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk \n\t\t\t\tWHERE frm_threads.thr_top_fk = %s {$act_clause})\n\t\t\t\t\n\t\t\t\tUNION ALL\n\t\t\t\t \n\t\t\t\t(SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt\n\t\t\t\tFROM frm_user_read\n\t\t\t\tINNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk\n\t\t\t\tINNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk \n\t\t\t\tWHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s {$act_clause})\n\t\t\t";
         $types = array('integer', 'integer', 'integer');
         $values = array($forumId, $ilUser->getId(), $forumId);
         $forum_overview_setting = (int) $ilSetting::_lookupValue('frma', 'forum_overview');
         if ($forum_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
             $news_types = array('integer', 'integer', 'integer', 'timestamp', 'integer');
             $news_values = array($ilUser->getId(), $ilUser->getId(), $forumId, $new_deadline, $ilUser->getId());
             $query .= " \n\t\t\t\tUNION ALL\n\t\t\t\t\n\t\t\t\t(SELECT COUNT(frm_posts.pos_pk) cnt\n\t\t\t\tFROM frm_posts\n\t\t\t\tLEFT JOIN frm_user_read ON (post_id = frm_posts.pos_pk AND frm_user_read.usr_id = %s)\n\t\t\t\tLEFT JOIN frm_thread_access ON (frm_thread_access.thread_id = frm_posts.pos_thr_fk AND frm_thread_access.usr_id = %s)\n\t\t\t\tWHERE frm_posts.pos_top_fk = %s\n\t\t\t\tAND ( (frm_posts.pos_update > frm_thread_access.access_old_ts)\n\t\t\t\t\t\tOR (frm_thread_access.access_old IS NULL AND frm_posts.pos_update > %s)\n\t\t\t\t\t)\n\t\t\t\tAND frm_posts.pos_author_id != %s \n\t\t\t\tAND frm_user_read.usr_id IS NULL {$act_clause})";
             $types = array_merge($types, $news_types);
             $values = array_merge($values, $news_values);
         }
         $mapping = array_keys($statistics);
         $res = $ilDB->queryF($query, $types, $values);
         for ($i = 0; $i <= 2; $i++) {
             $row = $ilDB->fetchAssoc($res);
             $statistics[$mapping[$i]] = (int) $row['cnt'];
             if ($i == 1) {
                 // unread = all - read
                 $statistics[$mapping[$i]] = $statistics[$mapping[$i - 1]] - $statistics[$mapping[$i]];
             }
         }
     } else {
         $query = "\n\t\t\t\tSELECT COUNT(frm_posts.pos_pk) cnt\n\t\t\t\tFROM frm_posts\n\t\t\t\tINNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk \n\t\t\t\tWHERE frm_threads.thr_top_fk = %s {$act_clause}\n\t\t\t";
         $types = array('integer');
         $values = array($forumId);
         $res = $ilDB->queryF($query, $types, $values);
         $row = $ilDB->fetchAssoc($res);
         $statistics = array('num_posts' => $row['cnt'], 'num_unread_posts' => $row['cnt'], 'num_new_posts' => $row['cnt']);
     }
     self::$forum_statistics_cache[$ref_id] = $statistics;
     return self::$forum_statistics_cache[$ref_id];
 }
 /**
  *
  */
 public function detachModeratorRole()
 {
     if (!isset($_POST['usr_id']) || !is_array($_POST['usr_id'])) {
         ilUtil::sendFailure($this->lng->txt('frm_moderators_select_at_least_one'));
         return $this->showModerators();
     }
     $entries = $this->oForumModerators->getCurrentModerators();
     if (count($_POST['usr_id']) == count($entries)) {
         ilUtil::sendFailure($this->lng->txt('frm_at_least_one_moderator'));
         return $this->showModerators();
     }
     include_once "Modules/Forum/classes/class.ilForumNotification.php";
     $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id);
     if ($isCrsGrp) {
         global $tree;
         $parent_ref_id = $tree->getParentId($this->ref_id);
         include_once "Services/Membership/classes/class.ilParticipants.php";
     }
     include_once "Modules/Forum/classes/class.ilForumProperties.php";
     $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id));
     $frm_noti_type = $objFrmProps->getNotificationType();
     foreach ($_POST['usr_id'] as $usr_id) {
         $this->oForumModerators->detachModeratorRole((int) $usr_id);
         if ($isCrsGrp && $frm_noti_type != 'default') {
             if (!ilParticipants::_isParticipant($this->ref_id, $usr_id)) {
                 $tmp_frm_noti = new ilForumNotification($this->ref_id);
                 $tmp_frm_noti->setUserId((int) $usr_id);
                 $tmp_frm_noti->setForumId(ilObject::_lookupObjId($this->ref_id));
                 $tmp_frm_noti->deleteAdminForce();
             }
         }
     }
     ilUtil::sendSuccess($this->lng->txt('frm_moderators_detached_role_successfully'), true);
     $this->ctrl->redirect($this, 'showModerators');
 }
Beispiel #8
0
 /**
  * @param $a_topic_id
  * @param array $params
  * @param int $limit
  * @param int $offset
  * @return array
  */
 public function getAllThreads($a_topic_id, array $params = array(), $limit = 0, $offset = 0)
 {
     /**
      * @var $ilDB   ilDB
      * @var $ilUser ilObjUser
      * @var $ilSetting ilSetting
      */
     global $ilDB, $ilUser, $ilSetting;
     $frm_overview_setting = (int) $ilSetting::_lookupValue('frma', 'forum_overview');
     $frm_props = ilForumProperties::getInstance($this->getForumId());
     $excluded_ids_condition = '';
     if (isset($params['excluded_ids']) && is_array($params['excluded_ids']) && $params['excluded_ids']) {
         $excluded_ids_condition = ' AND ' . $ilDB->in('thr_pk', $params['excluded_ids'], true, 'integer') . ' ';
     }
     if (!in_array(strtolower($params['order_column']), array('lp_date', 'rating'))) {
         $params['order_column'] = 'post_date';
     }
     if (!in_array(strtolower($params['order_direction']), array('asc', 'desc'))) {
         $params['order_direction'] = 'desc';
     }
     // Count all threads for the passed forum
     $query = "SELECT COUNT(thr_pk) cnt\n\t\t\t\t  FROM frm_threads\n\t\t\t\t  WHERE thr_top_fk = %s {$excluded_ids_condition}";
     $res = $ilDB->queryF($query, array('integer'), array($a_topic_id));
     $data = $ilDB->fetchAssoc($res);
     $cnt = (int) $data['cnt'];
     $threads = array();
     $data = array();
     $data_types = array();
     $active_query = '';
     $active_inner_query = '';
     $is_post_activation_enabled = $frm_props->isPostActivationEnabled();
     if ($is_post_activation_enabled && !$params['is_moderator']) {
         $active_query = ' AND (pos_status = %s OR pos_author_id = %s) ';
         $active_inner_query = ' AND (ipos.pos_status = %s OR ipos.pos_author_id = %s) ';
     }
     $optional_fields = '';
     if ($frm_props->isIsThreadRatingEnabled()) {
         $optional_fields = ',avg_rating';
     }
     if ($frm_props->getThreadSorting() == 1) {
         $optional_fields = ',thread_sorting';
     }
     $additional_sort = '';
     if ($frm_props->getThreadSorting()) {
         $additional_sort .= ' ,thread_sorting ASC ';
     }
     $dynamic_columns = array(' ,post_date ' . $params['order_direction']);
     if ($frm_props->isIsThreadRatingEnabled()) {
         $dynamic_columns[] = ' ,avg_rating ' . $params['order_direction'];
     }
     if ('rating' == strtolower($params['order_column'])) {
         $dynamic_columns = array_reverse($dynamic_columns);
     }
     $additional_sort .= implode(' ', $dynamic_columns);
     if (!$ilUser->isAnonymous()) {
         $query = "SELECT\n\t\t\t\t\t  (CASE WHEN COUNT(DISTINCT(notification_id)) > 0 THEN 1 ELSE 0 END) usr_notification_is_enabled,\n\t\t\t\t\t  MAX(pos_date) post_date,\n\t\t\t\t\t  COUNT(DISTINCT(pos_pk)) num_posts, \n\t\t\t\t\t  COUNT(DISTINCT(pos_pk)) - COUNT(DISTINCT(postread.post_id)) num_unread_posts, ";
         // new posts query
         if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
             $query .= "\n\t\t\t\t\t  (SELECT COUNT(DISTINCT(ipos.pos_pk))\n\t\t\t\t\t\tFROM frm_posts ipos\n\t\t\t\t\t\tLEFT JOIN frm_user_read iread ON iread.post_id = ipos.pos_pk AND iread.usr_id = %s\n\t\t\t\t\t\tLEFT JOIN frm_thread_access iacc ON (iacc.thread_id = ipos.pos_thr_fk AND iacc.usr_id = %s)\n\t\t\t\t\t\tWHERE ipos.pos_thr_fk = thr_pk\n\t\t\t\t\t\t \n\t\t\t\t\t\tAND (ipos.pos_update > iacc.access_old_ts\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t(iacc.access_old IS NULL AND (ipos.pos_update > " . $ilDB->quote(date('Y-m-d H:i:s', NEW_DEADLINE), 'timestamp') . "))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t \n\t\t\t\t\t\tAND ipos.pos_author_id != %s\n\t\t\t\t\t\tAND iread.usr_id IS NULL {$active_inner_query}\n\t\t\t\t\t  ) num_new_posts, ";
         }
         $query .= " thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed\n\t\t\t\t\t  {$optional_fields}\n\t\t\t\t\t  FROM frm_threads\n\t\t\t\t\t  \n\t\t\t\t\t  LEFT JOIN frm_notification\n\t\t\t\t\t\tON frm_notification.thread_id = thr_pk\n\t\t\t\t\t\tAND frm_notification.user_id = %s\n\t\t\t\t\t  \n\t\t\t\t\t  LEFT JOIN frm_posts\n\t\t\t\t\t\tON pos_thr_fk = thr_pk {$active_query}\n\t\t\t\t\t  \n\t\t\t\t\t  LEFT JOIN frm_user_read postread\n\t\t\t\t\t\tON postread.post_id = pos_pk\n\t\t\t\t\t\tAND postread.usr_id = %s";
         $query .= " WHERE thr_top_fk = %s\n\t\t\t\t\t\t{$excluded_ids_condition}\n\t\t\t\t\t\tGROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed\n\t\t\t\t\t\t{$optional_fields}\n\t\t\t\t\t\tORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
         // data_types for new posts query and $active_inner_query
         if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
             $data_types[] = 'integer';
             $data_types[] = 'integer';
             $data_types[] = 'integer';
             if ($is_post_activation_enabled && !$params['is_moderator']) {
                 array_push($data_types, 'integer', 'integer');
             }
         }
         $data_types[] = 'integer';
         if ($is_post_activation_enabled && !$params['is_moderator']) {
             array_push($data_types, 'integer', 'integer');
         }
         $data_types[] = 'integer';
         $data_types[] = 'integer';
         // data_values for new posts query and $active_inner_query
         if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
             $data[] = $ilUser->getId();
             $data[] = $ilUser->getId();
             $data[] = $ilUser->getId();
             if ($is_post_activation_enabled && !$params['is_moderator']) {
                 array_push($data, '1', $ilUser->getId());
             }
         }
         $data[] = $ilUser->getId();
         if ($is_post_activation_enabled && !$params['is_moderator']) {
             array_push($data, '1', $ilUser->getId());
         }
         $data[] = $ilUser->getId();
         $data[] = $a_topic_id;
     } else {
         $query = "SELECT\n\t\t\t\t\t  0 usr_notification_is_enabled,\n\t\t\t\t\t  MAX(pos_date) post_date,\n\t\t\t\t\t  COUNT(DISTINCT(pos_pk)) num_posts,\n\t\t\t\t\t  COUNT(DISTINCT(pos_pk)) num_unread_posts,\n\t\t\t\t\t  COUNT(DISTINCT(pos_pk)) num_new_posts,\n\t\t\t\t\t  thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed\n\t\t\t\t\t  {$optional_fields}\n\t\t\t\t\t  FROM frm_threads\n\t\t\t\t\t  \n\t\t\t\t\t  LEFT JOIN frm_posts\n\t\t\t\t\t\tON pos_thr_fk = thr_pk {$active_query}";
         $query .= " WHERE thr_top_fk = %s\n\t\t\t\t\t\t{$excluded_ids_condition}\n\t\t\t\t\t\tGROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed\n\t\t\t\t\t\t{$optional_fields}\n\t\t\t\t\t\tORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
         if ($is_post_activation_enabled && !$params['is_moderator']) {
             array_push($data_types, 'integer', 'integer');
         }
         $data_types[] = 'integer';
         if ($is_post_activation_enabled && !$params['is_moderator']) {
             array_push($data, '1', $ilUser->getId());
         }
         $data[] = $a_topic_id;
     }
     if ($limit || $offset) {
         $ilDB->setLimit($limit, $offset);
     }
     $res = $ilDB->queryF($query, $data_types, $data);
     while ($row = $ilDB->fetchAssoc($res)) {
         $thread = new ilForumTopic($row['thr_pk'], $params['is_moderator'], true);
         $thread->assignData($row);
         $threads[] = $thread;
     }
     return array('items' => $threads, 'cnt' => $cnt);
 }
 /**
  * @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');
 }