/**
  * Get processed message
  *
  * @param $aMessages array
  * @param $bDeleteAllowed boolean
  * @param $bBlockAllowed boolean
  * @return text
  */
 function getProcessedMessages($aMessages = array(), $bDeleteAllowed = false, $bBlockAllowed = false)
 {
     global $oFunctions;
     if (!$aMessages) {
         return;
     }
     $sOutputCode = '';
     $aLanguageKeys = array('by' => _t('_bx_shoutbox_by'), 'visitor' => _t('_Visitor'), 'delete' => _t('_bx_shoutbox_delete_message'), 'sure' => _t('_Are_you_sure'), 'block' => _t('_bx_shoutbox_block_ip'));
     foreach ($aMessages as $iKey => $aItems) {
         $sMemberIcon = '';
         $aProfileInfo = $aItems['OwnerID'] > 0 ? getProfileInfo($aItems['OwnerID']) : array();
         // define some profile's data;
         if ($aProfileInfo) {
             $sNickName = getNickName($aProfileInfo['ID']);
             $sLink = getProfileLink($aItems['OwnerID']);
             $sMemberIcon = $oFunctions->getMemberIcon($aItems['OwnerID']);
         } else {
             $sLink = 'javascript:void(0)';
             $sNickName = $aLanguageKeys['visitor'];
         }
         $aKeys = array('owner_icon' => $sMemberIcon, 'message' => WordWrapStr($aItems['Message']), 'by' => $aLanguageKeys['by'], 'owner_nick' => $sNickName, 'date' => defineTimeInterval($aItems['DateTS'], true, true), 'owner_link' => $sLink, 'bx_if:delete_allowed' => array('condition' => $bDeleteAllowed, 'content' => array('delete_cpt' => bx_html_attribute($aLanguageKeys['delete']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])), 'bx_if:block_allowed' => array('condition' => $bBlockAllowed, 'content' => array('block_cpt' => bx_html_attribute($aLanguageKeys['block']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])));
         $sTemplateName = $aProfileInfo ? 'message.html' : 'visitor_message.html';
         $sOutputCode .= $this->parseHtmlByName($sTemplateName, $aKeys);
     }
     return $sOutputCode;
 }
示例#2
0
 function getCommon($aEvent)
 {
     $sPrefix = $this->_oConfig->getCommonPostPrefix();
     if (strpos($aEvent['type'], $sPrefix) !== 0) {
         return '';
     }
     if (in_array($aEvent['type'], array($sPrefix . 'photos', $sPrefix . 'sounds', $sPrefix . 'videos'))) {
         $aContent = unserialize($aEvent['content']);
         $aEvent = array_merge($aEvent, $this->getCommonMedia($aContent['type'], (int) $aContent['id']));
         if (empty($aEvent['content']) || (int) $aEvent['content'] > 0) {
             return '';
         }
     }
     $aAuthor = $this->_oDb->getUser($aEvent['object_id']);
     $aVariables = array('author_url' => getProfileLink($aAuthor['id']), 'author_username' => getNickName($aAuthor['id']), 'bx_if:show_wall_owner' => array('condition' => (int) $aEvent['owner_id'] != (int) $aEvent['object_id'], 'content' => array('owner_url' => getProfileLink($aEvent['owner_id']), 'owner_username' => getNickName($aEvent['owner_id']))), 'post_id' => $aEvent['id'], 'post_owner_icon' => get_member_icon($aAuthor['id'], 'none'), 'post_content' => $aEvent['content']);
     switch (str_replace($sPrefix, '', $aEvent['type'])) {
         case 'text':
             $aVariables = array_merge($aVariables, array('post_content' => WordWrapStr($aVariables['post_content'])));
             break;
         case 'link':
         case 'photos':
         case 'videos':
         case 'sounds':
             break;
     }
     $oComments = new BxWallCmts($this->_oConfig->getCommentSystemName(), $aEvent['id']);
     $aVariables = array_merge($aVariables, array('comments_content' => $oComments->getCommentsFirst('comment')));
     return $this->parseHtmlByTemplateName('balloon', $aVariables);
 }
示例#3
0
 function _prepareTextForSave($s)
 {
     if ($this->iGlobAllowHtml || $this->isTagsAllowed()) {
         $iTagsAction = BX_TAGS_VALIDATE;
     } elseif (!$this->iGlobAllowHtml && $this->isNl2br()) {
         $s = WordWrapStr($s);
         $iTagsAction = BX_TAGS_STRIP_AND_NL2BR;
     } else {
         $iTagsAction = BX_TAGS_STRIP;
     }
     return process_db_input($s, $iTagsAction);
 }
示例#4
0
 function _getCommentBodyBox(&$a)
 {
     return '
             <td class="' . $this->_sStylePrefix . '-cont-l">&nbsp;</td>
             <td class="' . $this->_sStylePrefix . '-cont-m">' . ($this->_aSystem['is_mood'] ? '<div class="cmt-mood">' . $a['cmt_mood'] . '</div>' : '') . '<div class="cmt-body">' . ($this->iGlobUseTinyMCE || $this->isTagsAllowed() || strncasecmp($a['cmt_text'], '<object', 7) == 0 || strncasecmp($a['cmt_text'], '<iframe', 7) == 0 ? $a['cmt_text'] : WordWrapStr($a['cmt_text'])) . '</div>
             </td>
             <td class="' . $this->_sStylePrefix . '-cont-r">&nbsp;</td>';
 }