/** * Common public methods. * Is used to display events on the Wall. */ function getSystem($aEvent, $sDisplayType = BX_WALL_VIEW_TIMELINE) { $sResult = ""; $sHandler = $aEvent['type'] . '_' . $aEvent['action']; if (!$this->_oConfig->isHandler($sHandler)) { return ''; } $aHandler = $this->_oConfig->getHandlers($sHandler); if (empty($aHandler['module_uri']) && empty($aHandler['module_class']) && empty($aHandler['module_method'])) { $sMethod = 'display' . str_replace(' ', '', ucwords(str_replace('_', ' ', $aHandler['alert_unit'] . '_' . $aHandler['alert_action']))); if (!method_exists($this, $sMethod)) { return ''; } $aResult = $this->{$sMethod}($aEvent, $sDisplayType); } else { $aEvent['js_mode'] = $this->_oConfig->getJsMode(); $sMethod = $aHandler['module_method'] . ($sDisplayType == BX_WALL_VIEW_OUTLINE ? '_' . BX_WALL_VIEW_OUTLINE : ''); $aResult = BxDolService::call($aHandler['module_uri'], $sMethod, array($aEvent), $aHandler['module_class']); if (isset($aResult['save'])) { $this->_oDb->updateEvent($aResult['save'], $aEvent['id']); } } $bResult = !empty($aResult); if ($bResult && isset($aResult['perform_delete']) && $aResult['perform_delete'] == true) { $this->_oDb->deleteEvent(array('id' => $aEvent['id'])); return ''; } else { if (!$bResult || $bResult && empty($aResult['content'])) { return ''; } } $sComments = ""; if ($sDisplayType == BX_WALL_VIEW_TIMELINE) { if (empty($aEvent['title']) && !empty($aResult['title']) || empty($aEvent['description']) && !empty($aResult['description'])) { $this->_oDb->updateEvent(array('title' => process_db_input($aResult['title'], BX_TAGS_STRIP), 'description' => process_db_input($aResult['description'], BX_TAGS_STRIP)), $aEvent['id']); } if (!in_array($aEvent['type'], array('profile', 'friend')) && $aEvent['action'] != 'commentPost') { $sType = $aEvent['type']; $iObjectId = $aEvent['object_id']; if (strpos($iObjectId, ',') !== false) { $sType = isset($aResult['grouped']['group_cmts_name']) ? $aResult['grouped']['group_cmts_name'] : ''; $iObjectId = isset($aResult['grouped']['group_id']) ? (int) $aResult['grouped']['group_id'] : 0; } $oComments = new BxWallCmts($sType, $iObjectId); if ($oComments->isEnabled()) { $sComments = $oComments->getCommentsFirstSystem('comment', $aEvent['id']); } else { $sComments = $this->getDefaultComments($aEvent['id']); } } else { $sComments = $this->getDefaultComments($aEvent['id']); } } return $this->parseHtmlByContent($aResult['content'], array('post_id' => $aEvent['id'], 'post_owner_icon' => get_member_icon($aEvent['owner_id'], 'none'), 'comments_content' => $sComments)); }
/** * Common public methods. * Is used to display events on the Wall. */ function getSystem($aEvent, $sDisplayType = BX_WALL_VIEW_TIMELINE) { $sHandler = $aEvent['type'] . '_' . $aEvent['action']; if (!$this->_oConfig->isHandler($sHandler)) { return ''; } $aResult = $this->_getSystemData($aEvent, $sDisplayType); $bResult = !empty($aResult); if ($bResult && isset($aResult['perform_delete']) && $aResult['perform_delete'] == true) { $this->_oDb->deleteEvent(array('id' => $aEvent['id'])); return ''; } else { if (!$bResult || $bResult && empty($aResult['content'])) { return ''; } } $sResult = ""; switch ($sDisplayType) { case BX_WALL_VIEW_TIMELINE: if (empty($aEvent['title']) && !empty($aResult['title']) || empty($aEvent['description']) && !empty($aResult['description'])) { $this->_oDb->updateEvent(array('title' => process_db_input($aResult['title'], BX_TAGS_STRIP), 'description' => process_db_input($aResult['description'], BX_TAGS_STRIP)), $aEvent['id']); } if (!in_array($aEvent['type'], array('profile', 'friend'))) { $sType = $aEvent['type']; $iObjectId = $aEvent['object_id']; if ($aEvent['action'] == 'comment_add') { $aContent = unserialize($aEvent['content']); $iObjectId = (int) $aContent['object_id']; } if ($this->_oConfig->isGrouped($aEvent['type'], $aEvent['action'], $iObjectId)) { $sType = isset($aResult['grouped']['group_cmts_name']) ? $aResult['grouped']['group_cmts_name'] : ''; $iObjectId = isset($aResult['grouped']['group_id']) ? (int) $aResult['grouped']['group_id'] : 0; } $oComments = new BxWallCmts($sType, $iObjectId); if ($oComments->isEnabled()) { $sComments = $oComments->getCommentsFirstSystem('comment', $aEvent['id']); } else { $sComments = $this->getDefaultComments($aEvent['id']); } } else { $sComments = $this->getDefaultComments($aEvent['id']); } $sResult = $this->parseHtmlByTemplateName('balloon', array('post_type' => $aEvent['type'], 'post_id' => $aEvent['id'], 'post_owner_icon' => get_member_thumbnail($aEvent['owner_id'], 'none'), 'post_content' => $aResult['content'], 'comments_content' => $sComments)); break; case BX_WALL_VIEW_OUTLINE: $sResult = $this->parseHtmlByContent($aResult['content'], array('post_id' => $aEvent['id'], 'post_owner_icon' => get_member_icon($aEvent['owner_id'], 'none'), 'comments_content' => $sComments)); break; } return $sResult; }
function getCommon($aEvent) { $sPrefix = $this->_oConfig->getCommonPostPrefix(); if (strpos($aEvent['type'], $sPrefix) !== 0) { return ''; } $sEventType = bx_ltrim_str($aEvent['type'], $sPrefix, ''); $aResult = $this->_getCommonData($aEvent); if (empty($aResult) || empty($aResult['content'])) { return ''; } switch ($sEventType) { case BX_WALL_PARSE_TYPE_PHOTOS: case BX_WALL_PARSE_TYPE_SOUNDS: case BX_WALL_PARSE_TYPE_VIDEOS: $aContent = unserialize($aEvent['content']); $oComments = new BxWallCmts($this->_oConfig->getCommonName($aContent['type']), $aContent['id']); if ($oComments->isEnabled()) { $aResult['comments'] = $oComments->getCommentsFirstSystem('comment', $aEvent['id']); } else { $aResult['comments'] = $this->getDefaultComments($aEvent['id']); } break; default: $aResult['comments'] = $this->getDefaultComments($aEvent['id']); } return $this->parseHtmlByTemplateName('balloon', array('post_type' => bx_ltrim_str($aEvent['type'], $sPrefix, ''), 'post_id' => $aEvent['id'], 'post_owner_icon' => $this->getOwnerThumbnail((int) $aEvent['object_id']), 'post_content' => $aResult['content'], 'comments_content' => $aResult['comments'])); }
/** * Common public methods. * Is used to display events on the Wall. */ function getSystem($aEvent, $sDisplayType = BX_WALL_VIEW_TIMELINE) { $sHandler = $aEvent['type'] . '_' . $aEvent['action']; if (!$this->_oConfig->isHandler($sHandler)) { return ''; } $aResult = $this->_getSystemData($aEvent, $sDisplayType); $bResult = !empty($aResult); if ($bResult && isset($aResult['perform_delete']) && $aResult['perform_delete'] == true) { $this->_oDb->deleteEvent(array('id' => $aEvent['id'])); return ''; } else { if (!$bResult || $bResult && empty($aResult['content'])) { return ''; } } $sResult = ""; switch ($sDisplayType) { case BX_WALL_VIEW_TIMELINE: if (empty($aEvent['title']) && !empty($aResult['title']) || empty($aEvent['description']) && !empty($aResult['description'])) { $this->_oDb->updateEvent(array('title' => process_db_input($aResult['title'], BX_TAGS_STRIP), 'description' => process_db_input($aResult['description'], BX_TAGS_STRIP)), $aEvent['id']); } if (!in_array($aEvent['type'], array('profile', 'friend'))) { $sType = $aEvent['type']; $iObjectId = $aEvent['object_id']; if ($aEvent['action'] == 'comment_add') { $aContent = unserialize($aEvent['content']); $iObjectId = (int) $aContent['object_id']; } if ($this->_oConfig->isGrouped($aEvent['type'], $aEvent['action'], $iObjectId)) { $sType = isset($aResult['grouped']['group_cmts_name']) ? $aResult['grouped']['group_cmts_name'] : ''; $iObjectId = isset($aResult['grouped']['group_id']) ? (int) $aResult['grouped']['group_id'] : 0; } $oComments = new BxWallCmts($sType, $iObjectId); if ($oComments->isEnabled()) { $sComments = $oComments->getCommentsFirstSystem('comment', $aEvent['id']); } else { $sComments = $this->getDefaultComments($aEvent['id']); } } else { $sComments = $this->getDefaultComments($aEvent['id']); } $sResult = $this->parseHtmlByTemplateName('balloon', array('post_type' => $aEvent['type'], 'post_id' => $aEvent['id'], 'post_owner_icon' => get_member_thumbnail($aEvent['owner_id'], 'none'), 'post_content' => $aResult['content'], 'comments_content' => $sComments)); break; case BX_WALL_VIEW_OUTLINE: //--- Votes $sVote = ''; $oVote = $this->_oModule->_getObjectVoting($aEvent); if ($oVote->isVotingAllowed()) { $sVote = $oVote->getVotingOutline(); } //--- Repost $sRepost = ''; if ($this->_oModule->_isRepostAllowed($aEvent)) { $iOwnerId = $this->_oModule->_getAuthorId(); //--- in whose timeline the content will be shared $iObjectId = $this->_oModule->_oConfig->isSystem($aEvent['type'], $aEvent['action']) ? $aEvent['object_id'] : $aEvent['id']; $sRepost = $this->_oModule->serviceGetRepostElementBlock($iOwnerId, $aEvent['type'], $aEvent['action'], $iObjectId, array('show_do_repost_as_button_small' => true, 'show_do_repost_icon' => true, 'show_do_repost_label' => false)); } $sResult = $this->parseHtmlByContent($aResult['content'], array('post_id' => $aEvent['id'], 'post_owner_icon' => get_member_icon($aEvent['owner_id'], 'none'), 'post_vote' => $sVote, 'post_repost' => $sRepost)); break; } return $sResult; }