public function getCode() { // check if content exists if (!$this->_aAlbumInfo || !$this->_aMediaInfo) { // if entry is not found - display standard "404 page not found" page $this->_oTemplate->displayPageNotFound(); exit; } // permissions check if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aAlbumInfo))) { $this->_oTemplate->displayAccessDenied($sMsg); exit; } $this->_oModule->checkAllowedView($this->_aAlbumInfo, true); // count views $CNF =& $this->_oModule->_oConfig->CNF; if (!empty($CNF['OBJECT_VIEWS_MEDIA'])) { BxDolView::getObjectInstance($CNF['OBJECT_VIEWS_MEDIA'], $this->_aMediaInfo['id'])->doView(); } // add content metatags if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) { $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']); if ($o) { $aThumb = false; if (!empty($this->_aMediaInfo['file_id']) && !empty($CNF['OBJECT_IMAGES_TRANSCODER_BIG'])) { $aThumb = array('id' => $this->_aMediaInfo['file_id'], 'transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_BIG']); } $o->metaAdd($this->_aMediaInfo['id'], $aThumb); } } $aVars = array(); $this->_oTemplate->addInjection('injection_footer', 'text', $this->_oModule->_oTemplate->parseHtmlByName('photoswipe.html', $aVars)); return parent::getCode(); }
public function getCode() { // check if content exists if (!$this->_aContentInfo) { // if entry is not found - display standard "404 page not found" page $this->_oTemplate->displayPageNotFound(); exit; } // permissions check if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) { $this->_oTemplate->displayAccessDenied($sMsg); exit; } $this->_oModule->checkAllowedView($this->_aContentInfo, true); // count views $CNF =& $this->_oModule->_oConfig->CNF; if (!empty($CNF['OBJECT_VIEWS'])) { bx_import('BxDolView'); BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView(); } // add content metatags if (!empty($CNF['OBJECT_METATAGS'])) { bx_import('BxDolMetatags'); $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); if ($o) { $aThumb = false; if (!empty($CNF['FIELD_THUMB']) && !empty($this->_aContentInfo[$CNF['FIELD_THUMB']]) && !empty($CNF['OBJECT_STORAGE'])) { $aThumb = array('id' => $this->_aContentInfo[$CNF['FIELD_THUMB']], 'object' => $CNF['OBJECT_STORAGE']); } $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $aThumb); } } return parent::getCode(); }
public function getCode() { // check if content exists if (!$this->_aContentInfo) { // if entry is not found - display standard "404 page not found" page $this->_oTemplate->displayPageNotFound(); exit; } // permissions check if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) { $this->_oTemplate->displayAccessDenied($sMsg); exit; } $this->_oModule->checkAllowedView($this->_aContentInfo, true); // count views $CNF =& $this->_oModule->_oConfig->CNF; if (!empty($CNF['OBJECT_VIEWS'])) { BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView(); } // add content metatags if (!empty($CNF['OBJECT_METATAGS'])) { $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); if ($o) { $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $this->_getThumbForMetaObject()); } } $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu'); // add actions menu to submenu if (isset($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP'])) { $oMenuSubmenu->setObjectActionsMenu($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP']); } // add social sharing menu to submenu $oMenuSubmenu->setServiceSocialSharing(array('module' => $this->MODULE, 'method' => 'entity_social_sharing')); return parent::getCode(); }
function entryLocation($iContentId) { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; if (empty($CNF['OBJECT_METATAGS'])) { return ''; } bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); $aVars = array('location' => $oMetatags->locationsString($iContentId)); return $this->parseHtmlByName('entry-location.html', $aVars); }
public function editDataForm($iContentId, $sDisplay = false) { $CNF =& $this->_oModule->_oConfig->CNF; if (false === $sDisplay) { $sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT']; } // get content data and profile info list($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId); if (!$aContentInfo) { return MsgBox(_t('_sys_txt_error_entry_is_not_defined')); } // check access if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedEdit($aContentInfo))) { return MsgBox($sMsg); } // check and display form $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay, $this->_oModule->_oTemplate); if (!$oForm) { return MsgBox(_t('_sys_txt_error_occured')); } $aSpecificValues = array(); bx_import('BxDolMetatags'); if (!empty($CNF['OBJECT_METATAGS'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); $aSpecificValues = $oMetatags->locationGet($iContentId, $CNF['FIELD_LOCATION_PREFIX']); } $oForm->initChecker($aContentInfo, $aSpecificValues); if (!$oForm->isSubmittedAndValid()) { return $oForm->getCode(); } // update data in the DB $aTrackTextFieldsChanges = null; $this->onDataEditBefore($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $aTrackTextFieldsChanges); if (!$oForm->update($aContentInfo[$CNF['FIELD_ID']], array(), $aTrackTextFieldsChanges)) { if (!$oForm->isValid()) { return $oForm->getCode(); } else { return MsgBox(_t('_sys_txt_error_entry_update')); } } $sResult = $this->onDataEditAfter($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $aTrackTextFieldsChanges, $oProfile); if ($sResult) { return $sResult; } // perform action $this->_oModule->checkAllowedEdit($aContentInfo, true); // redirect $this->_redirectAndExit('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]); }
/** * Get location map. * @param $sObject metatgs object to get keywords cloud for * @param $iId content id * @return map HTML string */ public function serviceLocationsMap($sObject, $iId, $sMapSize = '1000x144', $sMapKey = '') { $o = BxDolMetatags::getObjectInstance($sObject); $sLocationHtml = $o->locationsString($iId); if (!$sLocationHtml) { return ''; } $sLocationEncoded = rawurlencode(strip_tags($sLocationHtml)); $sProto = 0 == strncmp('https', BX_DOL_URL_ROOT, 5) ? 'https' : 'http'; $iScale = isset($_COOKIE['devicePixelRatio']) && (int) $_COOKIE['devicePixelRatio'] >= 2 ? 2 : 1; $sLang = BxDolLanguages::getInstance()->getCurrentLanguage(); $aVars = array('map_img' => $sProto . '://maps.googleapis.com/maps/api/staticmap?center=' . $sLocationEncoded . '&zoom=7&size=' . $sMapSize . '&maptype=roadmap&markers=size:small%7C' . $sLocationEncoded . '&scale=' . $iScale . '&language=' . $sLang . ($sMapKey ? '&key=' . $sMapKey : ''), 'location_string' => $sLocationHtml); $this->addCssJs(); return BxDolTemplate::getInstance()->parseHtmlByName('metatags_locations_map.html', $aVars); }
function entryText($aData, $sTemplateName = 'entry-text.html') { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; $aVars = $aData; $aVars['entry_title'] = isset($aData[$CNF['FIELD_TITLE']]) ? $aData[$CNF['FIELD_TITLE']] : ''; $aVars['entry_text'] = $aData[$CNF['FIELD_TEXT']]; $aVars['entry_location'] = ''; if (!empty($CNF['OBJECT_METATAGS'])) { bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); $aVars['text'] = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $aVars['text']); $aVars['entry_location'] = $oMetatags->locationsString($aData[$CNF['FIELD_ID']]); } return $this->parseHtmlByName($sTemplateName, $aVars); }
function delete($iContentId, $aContentInfo = array()) { $CNF =& $this->_oModule->_oConfig->CNF; // delete associated files if (!empty($CNF['OBJECT_STORAGE'])) { bx_import('BxDolStorage'); $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']); if ($oStorage) { $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId); } } // delete associated objects data if (!empty($CNF['OBJECT_VIEWS'])) { bx_import('BxDolView'); $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_VOTES'])) { bx_import('BxDolVote'); $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_COMMENTS'])) { bx_import('BxDolCmts'); $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_METATAGS'])) { bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); $oMetatags->onDeleteContent($iContentId); } // delete db record return parent::delete($iContentId); }
protected function _associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId) { parent::_associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId); $CNF =& $this->_oModule->_oConfig->CNF; $sData = ''; $sExif = ''; $aExif = false; $aFile = $oStorage->getFile($iFileId); if (0 == strncmp('image/', $aFile['mime_type'], 6)) { $oImageReize = BxDolImageResize::getInstance(); $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_BIG']); $a = $oImageReize->getImageSize($oTranscoder->getFileUrl($iFileId)); $sData = isset($a['w']) && isset($a['h']) ? $a['w'] . 'x' . $a['h'] : ''; if ($aExif = $oImageReize->getExifInfo($oStorage->getFileUrlById($iFileId))) { $a = array('Make', 'Model', 'FocalLength', 'ShutterSpeedValue', 'ExposureTime', 'ISOSpeedRatings', 'Orientation', 'Artist', 'Copyright', 'Flash', 'WhiteBalance', 'DateTimeOriginal', 'DateTimeDigitized', 'ExifVersion', 'COMPUTED', 'GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude', 'GPSTimeStamp', 'GPSImgDirectionRef', 'GPSImgDirection', 'GPSDateStamp'); $aExifFiltered = array(); foreach ($a as $sIndex) { if (isset($aExif[$sIndex])) { $aExifFiltered[$sIndex] = $aExif[$sIndex]; } } $sExif = serialize($aExifFiltered); } } if (false === $this->_oModule->_oDb->associateFileWithContent($iContentId, $iFileId, $this->getCleanValue('title-' . $iFileId), $sData, $sExif)) { return; } $aMediaInfo = $this->_oModule->_oDb->getMediaInfoSimpleByFileId($iFileId); if ($aMediaInfo && !empty($CNF['OBJECT_METATAGS_MEDIA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']); if ($oMetatags->keywordsIsEnabled()) { $oMetatags->keywordsAdd($aMediaInfo['id'], $aMediaInfo['title']); } } if ($aMediaInfo && isset($aExif['Make']) && !empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']); if ($oMetatags->keywordsIsEnabled()) { $oMetatags->keywordsAddOne($aMediaInfo['id'], $oMetatags->keywordsCameraModel($aExif)); } } }
/** * Get keywords cloud. * @param $sObject metatgs object to get keywords cloud for * @param $iMaxCount number of tags in keywords cloud, by default @see BX_METATAGS_KEYWORDS_IN_CLOUD * @return tags cloud HTML string */ public function serviceKeywordsCloud($sObject, $sSection, $iMaxCount = BX_METATAGS_KEYWORDS_IN_CLOUD) { $o = BxDolMetatags::getObjectInstance($sObject); $aKeywords = $o->keywordsPopularList($iMaxCount); if (!$aKeywords) { return ''; } ksort($aKeywords, SORT_LOCALE_STRING); $iFontDiff = floor($this->_iKeywordsCloudFontSizeMax - $this->_iKeywordsCloudFontSizeMin); $iMinRating = min($aKeywords); $iMaxRating = max($aKeywords); $iRatingDiff = $iMaxRating - $iMinRating; $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff; $aUnits = array(); foreach ($aKeywords as $sKeyword => $iCount) { $aUnits[] = array('size' => $this->_iKeywordsCloudFontSizeMin + floor($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff)), 'href' => BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword) . '§ion[]=' . $sSection, 'count' => $iCount, 'keyword' => htmlspecialchars_adv($sKeyword)); } $aVars = array('bx_repeat:units' => $aUnits); $this->addCssJs(); return BxDolTemplate::getInstance()->parseHtmlByName('metatags_keywords_cloud.html', $aVars); }
function entryText($aData, $sTemplateName = 'entry-text.html') { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; $aVars = $aData; $aVars['entry_title'] = isset($aData[$CNF['FIELD_TITLE']]) ? $aData[$CNF['FIELD_TITLE']] : ''; $aVars['entry_text'] = $aData[$CNF['FIELD_TEXT']]; if (!empty($CNF['OBJECT_METATAGS'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); // keywords if ($oMetatags->keywordsIsEnabled()) { $aFields = $oMetatags->keywordsFields($aData, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']); foreach ($aFields as $sField) { $aVars[$sField] = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $aVars[$sField]); } } // location $aVars['location'] = $oMetatags->locationsIsEnabled() ? $oMetatags->locationsString($aData[$CNF['FIELD_ID']]) : ''; } return $this->parseHtmlByName($sTemplateName, $aVars); }
public function serviceDeleteFileAssociations($iFileId) { $CNF =& $this->_oConfig->CNF; if (!($aMediaInfo = $this->_oDb->getMediaInfoSimpleByFileId($iFileId))) { // file is already deleted return true; } if (!$this->_oDb->deassociateFileWithContent(0, $iFileId)) { return false; } if (!empty($CNF['OBJECT_VIEWS_MEDIA'])) { $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS_MEDIA'], $aMediaInfo['id']); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_VOTES_MEDIA'])) { $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_MEDIA'], $aMediaInfo['id']); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_COMMENTS_MEDIA'])) { $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS_MEDIA'], $aMediaInfo['id']); if ($o) { $o->onObjectDelete(); } } if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']); $oMetatags->onDeleteContent($aMediaInfo['id']); } if (!empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']); $oMetatags->onDeleteContent($aMediaInfo['id']); } return true; }
protected function _prepareTextForOutput($s, $iCmtId = 0) { $s = bx_process_output($s, BX_DATA_HTML); $s = bx_convert_links($s); if ($this->_sMetatagsObj && $iCmtId) { $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj); $s = $oMetatags->keywordsParse($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $s); } return $s; }
public function viewDataForm($iContentId, $sDisplay = false) { $CNF =& $this->_oModule->_oConfig->CNF; if (false === $sDisplay) { $sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']; } // get content data and profile info list($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId); if (!$aContentInfo) { return MsgBox(_t('_sys_txt_error_entry_is_not_defined')); } // check access if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($aContentInfo))) { return MsgBox($sMsg); } // get form $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay, $this->_oModule->_oTemplate); if (!$oForm) { return MsgBox(_t('_sys_txt_error_occured')); } // process metatags if (!empty($CNF['OBJECT_METATAGS'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); if ($oMetatags->keywordsIsEnabled()) { $aFields = $oMetatags->keywordsFields($aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']); $oForm->setMetatagsKeywordsData($iContentId, $aFields, $oMetatags); } } // display profile $oForm->initChecker($aContentInfo); return $oForm->getCode(); }
protected function _prepareTextForOutput($s, $iCmtId = 0) { $iDataAction = $this->isNl2br() ? BX_DATA_TEXT_MULTILINE : BX_DATA_HTML; $s = bx_process_output($s, $iDataAction); $s = bx_linkify_html($s); if ($this->_sMetatagsObj && $iCmtId) { $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj); $s = $oMetatags->keywordsParse($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $s); } return $s; }
public function onDelete($aEvent) { $sCommonPostPrefix = $this->_oConfig->getPrefix('common_post'); //--- Delete attached photos, videos and links when common event was deleted. if ($aEvent['type'] == $sCommonPostPrefix . BX_TIMELINE_PARSE_TYPE_POST) { $this->_deleteMedia(BX_TIMELINE_MEDIA_PHOTO, $aEvent['id']); $this->_deleteMedia(BX_TIMELINE_MEDIA_VIDEO, $aEvent['id']); $this->_deleteLinks($aEvent['id']); } //--- Update parent event when share event was deleted. if ($aEvent['type'] == $sCommonPostPrefix . BX_TIMELINE_PARSE_TYPE_SHARE) { $this->_oDb->deleteShareTrack($aEvent['id']); $aContent = unserialize($aEvent['content']); $aShared = $this->_oDb->getShared($aContent['type'], $aContent['action'], $aContent['object_id']); if (!empty($aShared) && is_array($aShared)) { $this->_oDb->updateShareCounter($aShared['id'], $aShared['shares'], -1); } } //--- Find and delete share events when parent event was deleted. $bSystem = $this->_oConfig->isSystem($aEvent['type'], $aEvent['action']); $aShareEvents = $this->_oDb->getEvents(array('browse' => 'shared_by_descriptor', 'type' => $aEvent['type'])); foreach ($aShareEvents as $aShareEvent) { $aContent = unserialize($aShareEvent['content']); if (isset($aContent['type']) && $aContent['type'] == $aEvent['type'] && isset($aContent['object_id']) && ($bSystem && (int) $aContent['object_id'] == (int) $aEvent['object_id'] || !$bSystem && (int) $aContent['object_id'] == (int) $aEvent['id'])) { $this->_oDb->deleteEvent(array('id' => (int) $aShareEvent['id'])); } } //--- Delete associated meta. $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags')); $oMetatags->onDeleteContent($aEvent['id']); //--- Event -> Delete for Alerts Engine ---// $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'delete', $aEvent['id'], $this->getUserId()); $oAlert->alert(); //--- Event -> Delete for Alerts Engine ---// }
protected function _prepareTextForOutput($s, $iEventId = 0) { $oTemplate =& $this; $sPattern = $this->_oConfig->getPregPattern('url'); $bAddNofollow = $this->_oDb->getParam('sys_add_nofollow') == 'on'; $s = bx_process_output($s, BX_DATA_TEXT_MULTILINE); $s = preg_replace_callback($sPattern, function ($aMatches) use($oTemplate, $bAddNofollow) { $aLinkAttrs = array(array('key' => 'target', 'value' => '_blank')); if ($bAddNofollow && strncmp(BX_DOL_URL_ROOT, $aMatches[0], strlen(BX_DOL_URL_ROOT)) != 0) { $aLinkAttrs[] = array('key' => 'rel', 'value' => 'nofollow'); } return $oTemplate->parsePageByName('bx_a.html', array('href' => (empty($aMatches[1]) ? 'http://' : '') . $aMatches[0], 'title' => $aMatches[0], 'bx_repeat:attrs' => $aLinkAttrs, 'content' => $aMatches[0])); }, $s); bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags')); $s = $oMetatags->keywordsParse($iEventId, $s); return $s; }
/** * Set class fields condition params and paginate array */ function setConditionParams() { // keyword $sKeyword = bx_process_input(bx_get('keyword')); if ($sKeyword !== false) { $this->aCurrent['restriction']['keyword'] = array('value' => $sKeyword, 'field' => '', 'operator' => 'against'); } // owner if (isset($_GET['ownerName'])) { $sName = bx_process_input($_GET['ownerName']); $iUser = (int) BxDolProfileQuery::getInstance()->getIdByNickname($sName); BxDolMenu::getInstance()->setCurrentProfileID($iUser); } elseif (isset($_GET['userID'])) { $iUser = bx_process_input($_GET['userID'], BX_DATA_INT); } if (!empty($iUser)) { $this->aCurrent['restriction']['owner']['value'] = $iUser; } // meta info if ($this->_sMetaType && !empty($this->aCurrent['object_metatags'])) { bx_import('BxDolMetatags'); $o = BxDolMetatags::getObjectInstance($this->aCurrent['object_metatags']); if ($o) { unset($this->aCurrent['restriction']['keyword']); switch ($this->_sMetaType) { case 'location_country': $o->locationsSetSearchCondition($this, $sKeyword); break; case 'location_country_city': $o->locationsSetSearchCondition($this, $sKeyword, bx_process_input(bx_get('state')), bx_process_input(bx_get('city'))); break; case 'mention': // TODO: break; case 'keyword': $o->keywordsSetSearchCondition($this, $sKeyword); break; } } } $this->setPaginate(); $iNum = $this->getNum(); if ($iNum > 0) { $this->aCurrent['paginate']['num'] = $iNum; } else { $this->aCurrent['paginate']['num'] = 0; } }
protected function onDataAddAfter($iContentId) { $CNF =& $this->_oModule->_oConfig->CNF; if (!($aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId))) { return MsgBox(_t('_sys_txt_error_occured')); } if (!empty($CNF['OBJECT_METATAGS'])) { bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); $oMetatags->keywordsAdd($aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_TEXT']]); $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']); } // alert bx_import('BxDolPrivacy'); $aParams = isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) ? array('privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) : array(); bx_alert($this->_oModule->getName(), 'added', $iContentId, false, $aParams); return ''; }
protected function _getFormEdit($iCmtId) { $aCmt = $this->_oQuery->getCommentSimple($this->getId(), $iCmtId); if (!$aCmt) { return array('msg' => _t('_No such comment')); } $iCmtAuthorId = $this->_getAuthorId(); if (!$this->isEditAllowed($aCmt)) { return array('msg' => $aCmt['cmt_author_id'] == $iCmtAuthorId ? strip_tags($this->msgErrEditAllowed()) : _t('_Access denied')); } $oForm = $this->_getForm(BX_CMT_ACTION_EDIT, $aCmt['cmt_id']); $aCmt['cmt_text'] = $this->_prepareTextForEdit($aCmt['cmt_text']); $oForm->initChecker($aCmt); if ($oForm->isSubmittedAndValid()) { $sCmtText = $oForm->getCleanValue('cmt_text'); $sCmtText = $this->_prepareTextForSave($sCmtText); $oForm->setSubmittedValue('cmt_text', $sCmtText, $oForm->aFormAttrs['method']); if ($oForm->update($iCmtId)) { $this->isEditAllowed(true); if ($this->_sMetatagsObj) { $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj); $oMetatags->keywordsAdd($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $sCmtText); } $oZ = new BxDolAlerts($this->_sSystem, 'commentUpdated', $this->getId(), $iCmtAuthorId, array('comment_id' => $aCmt['cmt_id'], 'comment_author_id' => $aCmt['cmt_author_id'])); $oZ->alert(); return array('id' => $iCmtId, 'text' => $this->_prepareTextForOutput($sCmtText, $iCmtId)); } return array('msg' => _t('_cmt_err_cannot_perform_action')); } return array('form' => $oForm->getCode(), 'form_id' => $oForm->id); }
protected function _prepareTextForOutput($s, $iCmtId = 0) { bx_import('BxDolTemplate'); $oTemplate = BxDolTemplate::getInstance(); $sPattern = "/((https?|ftp|news):\\/\\/)?([a-z]([a-z0-9\\-]*\\.)+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|[a-z]{2})|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\\/[a-z0-9_\\-\\.~]+)*(\\/([a-z0-9_\\-\\.]*)(\\?[a-z0-9+_\\-\\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/"; $bAddNofollow = $this->_oQuery->getParam('sys_add_nofollow') == 'on'; $s = bx_process_output($s, BX_DATA_HTML); $s = preg_replace_callback($sPattern, function ($aMatches) use($oTemplate, $bAddNofollow) { $aLinkAttrs = array(array('key' => 'target', 'value' => '_blank')); if ($bAddNofollow && strncmp(BX_DOL_URL_ROOT, $aMatches[0], strlen(BX_DOL_URL_ROOT)) != 0) { $aLinkAttrs[] = array('key' => 'rel', 'value' => 'nofollow'); } return $oTemplate->parsePageByName('bx_a.html', array('href' => (empty($aMatches[1]) ? 'http://' : '') . $aMatches[0], 'title' => $aMatches[0], 'bx_repeat:attrs' => $aLinkAttrs, 'content' => $aMatches[0])); }, $s); if ($this->_sMetatagsObj && $iCmtId) { bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj); $s = $oMetatags->keywordsParse($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $s); } return $s; }
public function onDataAddAfter($iAccountId, $iContentId) { if (!empty($CNF['OBJECT_METATAGS'])) { list($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId); $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); if ($oMetatags->keywordsIsEnabled()) { $oMetatags->keywordsAddAuto($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']); } if ($oMetatags->locationsIsEnabled()) { $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']); } } return ''; }
function mediaExif($aMediaInfo, $iProfileId = false, $sFuncAuthorDesc = '', $sTemplateName = 'media-exif.html') { if (!$aMediaInfo['exif']) { return ''; } $a = unserialize($aMediaInfo['exif']); $s = ''; if (isset($a['Make'])) { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; $sCamera = BxDolMetatags::keywordsCameraModel($a); if (!empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']); if ($oMetatags->keywordsIsEnabled()) { $sCamera = $oMetatags->keywordsParseOne($aMediaInfo['id'], $sCamera); } } $s .= $this->parseHtmlByName('media-exif-value.html', array('key' => _t('_bx_albums_txt_media_album_camera'), 'val' => $sCamera)); } if (isset($a['FocalLength'])) { $s .= $this->parseHtmlByName('media-exif-value.html', array('key' => _t('_bx_albums_txt_media_album_focal_length'), 'val' => _t('_bx_albums_txt_media_album_focal_length_value', $a['FocalLength']))); } if (isset($a['COMPUTED']['ApertureFNumber'])) { $s .= $this->parseHtmlByName('media-exif-value.html', array('key' => _t('_bx_albums_txt_media_album_aperture'), 'val' => $a['COMPUTED']['ApertureFNumber'])); } if (isset($a['ExposureTime'])) { $s .= $this->parseHtmlByName('media-exif-value.html', array('key' => _t('_bx_albums_txt_media_album_shutter_speed'), 'val' => _t('_bx_albums_txt_media_album_shutter_speed_value', $a['ExposureTime']))); } if (isset($a['ISOSpeedRatings'])) { $s .= $this->parseHtmlByName('media-exif-value.html', array('key' => _t('_bx_albums_txt_media_album_iso'), 'val' => $a['ISOSpeedRatings'])); } if (empty($s)) { return ''; } return $this->parseHtmlByName($sTemplateName, array('content' => $s)); }
protected function _prepareTextForOutput($s, $iEventId = 0) { $s = bx_process_output($s, BX_DATA_HTML); $s = bx_convert_links($s); $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags')); $s = $oMetatags->keywordsParse($iEventId, $s); return $s; }