function getCorrectUri($sCaption, $iOwnerId = 0, $bCheck = true) { $sUri = uriFilter($sCaption); if (!$sUri) { $sUri = '-'; } if (!$bCheck) { return $sUri; } if ($this->checkUriUniq($sUri, $iOwnerId)) { return $sUri; } if (get_mb_len($sUri) > 240) { $sUri = get_mb_substr($sUri, 0, 240); } $sUri .= '-' . date('Y-m-d'); if ($this->checkUriUniq($sUri, $iOwnerId)) { return $sUri; } for ($i = 0; $i < 999; ++$i) { if ($this->checkUriUniq($sUri . '-' . $i, $iOwnerId)) { return $sUri . '-' . $i; } } return time(); }
function serviceSetAvatar($iPhotoID, $iAuthorId = 0) { if (!$iAuthorId) { $iAuthorId = getLoggedId(); } $aFileInfo = $this->_oDb->getFileInfo(array('fileId' => $iPhotoID)); $sProfileAlbumUri = uriFilter(str_replace('{nickname}', getUsername($iAuthorId), $this->_oConfig->getGlParam('profile_album_name'))); if ($sProfileAlbumUri != $aFileInfo['albumUri']) { return false; } return $this->_oDb->setAvatar($iPhotoID, $aFileInfo['albumId']); }
function getBlockCode_ProfilePhotos() { list($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3) = $this->aAddParams; if ($sParamValue != 'owner') { return ''; } $oSearch = $this->getSearchObject(); $oSearch->aCurrent['restriction']['album'] = array('value' => '', 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums'); $oSearch->aCurrent['restriction']['album_owner'] = array('value' => '', 'field' => 'Owner', 'operator' => '=', 'paramName' => 'albumOwner', 'table' => 'sys_albums'); $sUri = uriFilter(str_replace('{nickname}', $sParamValue1, $this->oConfig->getGlParam('profile_album_name'))); $aParams = array('album' => $sUri, 'owner' => $this->iOwnerId); $aCustom = array('per_page' => $this->oConfig->getGlParam('number_top'), 'simple_paginate' => FALSE); $aHtml = $oSearch->getBrowseBlock($aParams, $aCustom); return array($aHtml['code'], $aHtml['menu_top'], $aHtml['menu_bottom'], ''); }
function _getMediaAlbumsArray($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) { switch ($sType) { case 'photo': $sModuleName = 'photos'; $sType = 'bx_photos'; $sMemAction = 'BX_PHOTOS_VIEW'; break; case 'video': $sModuleName = 'videos'; $sType = 'bx_videos'; $sMemAction = 'BX_VIDEOS_VIEW'; break; case 'music': $sModuleName = 'sounds'; $sType = 'bx_sounds'; $sMemAction = 'BX_SOUNDS_VIEW'; break; default: return array(); } if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) { return array(); } bx_import('BxDolMemberInfo'); $oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb')); $isSetAvatarFromDefaultAlbumOnly = $oMemberInfo->isSetAvatarFromDefaultAlbumOnly(); bx_import('BxDolAlbums'); $o = new BxDolAlbums($sType, (int) $iIdProfile); $aList = $o->getAlbumList(array('owner' => (int) $iIdProfile, 'show_empty' => $isShowEmptyAlbums), 1, 1000); $aRet = array(); foreach ($aList as $r) { if (!BxDolService::call($sModuleName, 'get_album_privacy', array((int) $r['ID'], $iIdProfileViewer), 'Search')) { continue; } if ($isSetAvatarFromDefaultAlbumOnly) { $isDefaulAlbum = $r['Uri'] == uriFilter(str_replace('{nickname}', getUsername($iIdProfile), getParam($sType . '_profile_album_name'))) ? 1 : 0; } else { $isDefaulAlbum = 1; } $aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount'], 'DefaultAlbum' => $isDefaulAlbum); } return $aRet; }
function BxVideosPageAlbumsMy(&$oShared, $iOwnerId, $aParams = array()) { parent::BxDolPageView('bx_videos_albums_my'); $this->oTemplate = $oShared->_oTemplate; $this->oConfig = $oShared->_oConfig; $this->oDb = $oShared->_oDb; $this->iOwnerId = $iOwnerId; $this->aAddParams = $aParams; $this->oSearch = new BxVideosSearch('album', $this->aAddParams[1], 'owner', getNickName($this->iOwnerId)); $this->oAlbum = new BxDolAlbums('bx_videos', $this->iOwnerId); if (isset($this->aSystemBlocks[$this->aAddParams[0]])) { $this->aCurrentBlocks = $this->aSystemBlocks[$this->aAddParams[0]]; } else { $this->aCurrentBlocks = $this->aSystemBlocks['main']; } $this->oTemplate->addCss(array('my.css', 'browse.css')); $this->oSearch->aCurrent['restriction']['ownerId'] = array('value' => $this->iOwnerId, 'field' => 'Owner', 'operator' => '=', 'paramName' => 'ownerId'); $sCaption = str_replace('{nickname}', getNickName($this->iOwnerId), $this->oConfig->getGlParam('profile_album_name')); $aOwnerDefAlbumInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => uriFilter($sCaption), 'owner' => $this->iOwnerId)); if (!is_array($aOwnerDefAlbumInfo) || empty($aOwnerDefAlbumInfo)) { $aData = array('caption' => $sCaption, 'location' => _t('_' . $this->oConfig->getMainPrefix() . '_undefined'), 'owner' => $this->iOwnerId, 'AllowAlbumView' => BX_DOL_PG_ALL); $this->oAlbum->addAlbum($aData, false); } }
function uriGenerate($s, $sTable, $sField, $iMaxLen = 255) { $s = uriFilter($s); if (uriCheckUniq($s, $sTable, $sField)) { return $s; } // try to add date if (get_mb_len($s) > 240) { $s = get_mb_substr($s, 0, 240); } $s .= '-' . date('Y-m-d'); if (uriCheckUniq($s, $sTable, $sField)) { return $s; } // try to add number for ($i = 0; $i < 999; ++$i) { if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) { return $s . '-' . $i; } } return rand(0, 999999999); }
function serviceGetProfileAlbumFiles($iProfileId) { $iProfileId = (int) $iProfileId; $sNickKey = '{nickname}'; $sNickName = getUsername($iProfileId); $sDefAlbumName = $this->oModule->_oConfig->getGlParam('profile_album_name'); if (strpos($sDefAlbumName, $sNickKey) !== false) { $sCaption = str_replace($sNickKey, $sNickName, $sDefAlbumName); } else { $sCaption = $sDefAlbumName; $this->aCurrent['restriction']['album_owner'] = array('value' => $iProfileId, 'field' => 'Owner', 'operator' => '=', 'paramName' => 'albumOwner', 'table' => 'sys_albums'); } $sUri = uriFilter($sCaption); $this->aCurrent['sorting'] = 'album_order'; $this->aCurrent['restriction']['album'] = array('value' => $sUri, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums'); $aFiles = $this->getSearchData(); if (is_array($aFiles)) { foreach ($aFiles as $iKey => $aData) { $aFiles[$iKey]['file'] = $this->getImgUrl($aData['id'], 'icon'); } } else { $aFiles = array(); } return $aFiles; }
function checkDefaultAlbums($iProfileId) { $sUri = $this->_oConfig->getUri(); $aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId))); foreach ($aAlbums as $sAlbum) { $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' => $iProfileId)); if (!empty($aAlbumInfo) && is_array($aAlbumInfo)) { continue; } $this->oAlbums->addAlbum(array('caption' => $sAlbum, 'location' => _t('_bx_' . $sUri . '_undefined'), 'owner' => $iProfileId, 'AllowAlbumView' => $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri, 'album_view')), false); } }
function getPhotoBlock($aParams = array()) { $aShowParams = array('showRate' => 1, 'showPaginate' => 0, 'showViews' => 0, 'showDate' => 0, 'showLink' => 0, 'showFrom' => 0); if (count($aParams) > 0) { foreach ($aParams as $sKeyName => $sKeyValue) { switch ($sKeyName) { case 'PID': $this->aCurrent['restriction']['owner']['value'] = (int) $sKeyValue; break; case 'Category': $this->aCurrent['restriction']['category']['value'] = strip_tags($sKeyValue); break; case 'Tag': $this->aCurrent['restriction']['tag']['value'] = strip_tags($sKeyValue); break; case 'Limit': $this->aCurrent['paginate']['perPage'] = (int) $sKeyValue; break; case 'DisplayPagination': if ($sKeyValue == 1) { $aShowParams['showPaginate'] = 1; } break; case 'DisplayViews': if ($sKeyValue == 1) { $aShowParams['showViews'] = 1; } break; case 'DisplayWhenAgo': if ($sKeyValue == 1) { $aShowParams['showDate'] = 1; } break; case 'DisplayLink': if ($sKeyValue == 1) { $aShowParams['showLink'] = 1; } break; case 'DisplayProfile': if ($sKeyValue == 1) { $aShowParams['showFrom'] = 1; } break; } } } $this->aCurrent['paginate']['perPage'] = 20; $aFilesList = $this->getSearchData(); $iCnt = $this->aCurrent['paginate']['totalNum']; if ($iCnt) { $aUnit = array(); $aUnits = array(); if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) { $iPhotoWidth = 294; $sImgWidth = 'style="width:' . $iPhotoWidth . 'px;"'; } else { $iPhotoWidth = (int) $this->oModule->_oConfig->getGlParam('file_width'); $iPhotoWidth = $iPhotoWidth > 1 ? $iPhotoWidth : 600; $sImgWidth = ''; } foreach ($aFilesList as $iKey => $aData) { $sPicUrl = $this->getImgUrl($aData['Hash'], 'icon'); $aUnits[] = array('imageId' => $iKey + 1, 'picUrl' => $sPicUrl); $sPicLinkElements .= 'aPicLink[' . ($iKey + 1) . '] = ' . $aData['id'] . ';'; if ($iKey == 0) { $aAdd = array('switchWidth' => $iPhotoWidth + 2, 'imgWidth' => $sImgWidth); $aUnit['switcherUnit'] = $this->getSwitcherUnit($aData, $aShowParams, $aAdd); } } $aUnit['moduleUrl'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri(); $aUnit['bx_repeat:iconBlock'] = $aUnits; $aUnit['count'] = $iCnt; $aUnit['contWidth'] = $iCnt * 40; $aUnit['picWidth'] = $iPhotoWidth; $aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2; $aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 4; if ($aUnit['contWidth'] > $aUnit['picWidth']) { $bScroller = true; $aUnit['containerWidth'] = $aUnit['picBoxWidth'] - 72; } else { $bScroller = false; $aUnit['containerWidth'] = $aUnit['contWidth']; } $aUnit['bx_if:scrollerBack'] = array('condition' => $bScroller, 'content' => array(1)); $aUnit['bx_if:scrollerNext'] = array('condition' => $bScroller, 'content' => array(1)); $aUnit['picLinkElements'] = $sPicLinkElements; if ($aShowParams['showPaginate'] == 1) { $aLinkAddon = $this->getLinkAddByPrams(); $oPaginate = new BxDolPaginate(array('page_url' => $aUnit['changeUrl'], 'count' => $iCnt, 'info' => false, 'per_page' => 1, 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})')); $aUnit['paginate'] = $oPaginate->getPaginate(); } else { $aUnit['paginate'] = ''; } $this->oTemplate->addCss('search.css'); return $this->oTemplate->parseHtmlByName('photo_switcher.html', $aUnit); } elseif ($this->oModule->_iProfileId != 0 && $this->oModule->_iProfileId == (int) $this->aCurrent['restriction']['owner']['value']) { ob_start(); ?> <div class="paginate"> <div class="view_all" style="background-image:url(__img_src__)"> <a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a> </div> </div> <?php $sCode = ob_get_clean(); $sLinkTitle = _t('_bx_photos_add'); $sNickName = getNickName($this->oModule->_iProfileId); $sCaption = uriFilter(str_replace('{nickname}', $sNickName, $this->oModule->_oConfig->getGlParam('profile_album_name'))); $aUnit = array('img_src' => $this->oTemplate->getIconUrl('more.png'), 'lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . $sNickName, 'lnk_title' => $sLinkTitle, 'lnk_content' => $sLinkTitle); return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, $aUnit); } return MsgBox(_t('_Empty')); }
function getProfilePhotoBlock($aParams) { $sCaption = str_replace('{nickname}', getUsername($aParams['PID']), $this->oModule->_oConfig->getGlParam('profile_album_name')); $sUri = uriFilter($sCaption); $oAlbum = new BxDolAlbums('bx_photos'); $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sUri, 'owner' => $aParams['PID']), array('ID')); if (empty($aAlbumInfo) && $this->oModule->_iProfileId == (int) $aParams['PID']) { $aData = array('caption' => $sCaption, 'location' => _t('_bx_photos_undefined'), 'owner' => $this->oModule->_iProfileId, 'AllowAlbumView' => $this->oModule->oAlbumPrivacy->_oDb->getDefaultValueModule('photos', 'album_view')); $aAlbumInfo['ID'] = $oAlbum->addAlbum($aData, false); } if (!$this->oModule->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->oModule->_iProfileId)) { return ''; } $this->aCurrent['sorting'] = 'album_order'; $this->aCurrent['restriction']['album'] = array('value' => $sUri, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums'); return $this->getPhotoBlock($aParams); }
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0, $aAlbumParams = array()) { if (!$iAuthorId) { $iAuthorId = $this->_iOwnerId; } $iObjId = (int) $iObjId; $aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID')); if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) { $iAlbumID = (int) $aAlbumInfo['ID']; } else { $iPrivacy = $sAlbumUri == $oAlbums->getAlbumDefaultName() ? BX_DOL_PG_HIDDEN : BX_DOL_PG_NOBODY; if (isset($aAlbumParams['privacy'])) { $iPrivacy = (int) $aAlbumParams['privacy']; } $aData = array('caption' => $sAlbumUri, 'location' => _t('_' . $oAlbums->sType . '_undefined'), 'owner' => $iAuthorId, 'AllowAlbumView' => $iPrivacy); $iAlbumID = $oAlbums->addAlbum($aData, false); } $oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter); }
function uriGenerate($s, $sTable, $sField, $sEmpty = '-') { $s = uriFilter($s, $sEmpty); if (uriCheckUniq($s, $sTable, $sField)) { return $s; } // cut off redundant part if (get_mb_len($s) > 240) { $s = get_mb_substr($s, 0, 240); } // try to add date $s .= '-' . date('Y-m-d'); if (uriCheckUniq($s, $sTable, $sField)) { return $s; } // try to add number for ($i = 0; $i < 999; ++$i) { if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) { return $s . '-' . $i; } } return rand(0, 999999999); }
function checkDefaultAlbums($iProfileId) { $sUri = $this->_oConfig->getUri(); $aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId))); foreach ($aAlbums as $sAlbum) { $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' => $iProfileId)); if (!empty($aAlbumInfo) && is_array($aAlbumInfo)) { continue; } $this->oAlbums->addAlbum(array('caption' => $sAlbum, 'owner' => $iProfileId, 'AllowAlbumView' => $sAlbum == getParam('sys_album_default_name') ? BX_DOL_PG_HIDDEN : $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri, 'album_view')), false); } }
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0) { if (!$iAuthorId) { $iAuthorId = $this->_iOwnerId; } $iObjId = (int) $iObjId; $aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID')); if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) { $iAlbumID = (int) $aAlbumInfo['ID']; } else { $aData = array('caption' => $sAlbumUri, 'location' => _t('_' . $oAlbums->sType . '_undefined'), 'owner' => $iAuthorId); $iAlbumID = $oAlbums->addAlbum($aData, false); } $oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter); }
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0, $aAlbumParams = array()) { if (!$iAuthorId) { $iAuthorId = $this->_iOwnerId; } $iObjId = (int) $iObjId; $aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID')); if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) { $iAlbumID = (int) $aAlbumInfo['ID']; } else { if (isset($aAlbumParams['privacy'])) { $iPrivacy = (int) $aAlbumParams['privacy']; } elseif ($sAlbumUri == $oAlbums->getAlbumDefaultName()) { $iPrivacy = BX_DOL_PG_HIDDEN; } else { bx_import('BxDolPrivacyQuery'); $oPrivacy = new BxDolPrivacyQuery(); $iPrivacy = $oPrivacy->getDefaultValueModule($this->oModule->_oConfig->getUri(), 'album_view'); if (!$iPrivacy) { $iPrivacy = BX_DOL_PG_NOBODY; } } $aData = array('caption' => $sAlbumUri, 'owner' => $iAuthorId, 'AllowAlbumView' => $iPrivacy); $iAlbumID = $oAlbums->addAlbum($aData, false); } $oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter); }
function _actionDownload($aFileInfo, $sFieldMediaId) { $aFile = BxDolService::call('files', 'get_file_array', array($aFileInfo[$sFieldMediaId]), 'Search'); if (!$aFile['date']) { $this->_oTemplate->displayPageNotFound(); exit; } $aFile['full_name'] = uriFilter($aFile['title']) . '.' . $aFile['extension']; $aPathInfo = pathinfo($aFile['path']); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-type: " . $aFile['mime_type']); header("Content-Length: " . filesize($aFile['path'])); header("Content-Disposition: attachment; filename={$aFile['full_name']}"); readfile($aFile['path']); exit; }
function _uploadImage($iProfileId = 0) { $iProfileId = (int) $iProfileId; $sImagePath = BX_AVA_DIR_TMP . ($iProfileId ? $iProfileId : $this->_iProfileId) . BX_AVA_EXT; $i = strrpos($_FILES['image']['name'], '.'); if (false === $i) { return false; } $sExt = strtolower(substr($_FILES['image']['name'], $i + 1)); if (!in_array($sExt, $this->_aAllowedExt)) { return false; } if (move_uploaded_file($_FILES['image']['tmp_name'], $sImagePath)) { if ($_POST['copy_to_profile_photos']) { if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) { $aFileInfo = array('medTitle' => _t('_bx_ava_avatar'), 'medDesc' => _t('_bx_ava_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iProfileId), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => BX_DOL_PG_ALL); $_POST[BX_DOL_UPLOADER_EP_PREFIX . 'album'] = uriFilter($aFileInfo['album']); BxDolService::call('photos', 'perform_photo_upload', array($sImagePath, $aFileInfo, false), 'Uploader'); } } return IMAGE_ERROR_SUCCESS == imageResize($sImagePath, '', BX_AVA_PRE_RESIZE_W, BX_AVA_PRE_RESIZE_H, true) ? true : false; } return false; }
function actionUpload($sAction = '') { $sOwnerNick = getUsername($this->_iProfileId); $sOwnerAlbum = str_replace('{nickname}', $sOwnerNick, $this->_oConfig->getGlParam('profile_album_name')); if (!empty($sAction)) { $aRes = array('status' => 'Fail', 'error_msg' => _t('_sys_txt_sbs_error_occured')); $iAlbumId = (int) $_GET['album']; if (!$iAlbumId) { $sTitle = clear_xss($_GET['title']); if (!empty($sTitle)) { $aNew = array('caption' => $sTitle, 'AllowAlbumView' => $_GET['AllowAlbumView'], 'owner' => $this->_iProfileId); $iAlbumId = $this->oAlbums->addAlbum($aNew); } else { $aRes['error_msg'] = _t('_title_min_lenght', 1); } } $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileid' => $iAlbumId), array('Uri', 'Owner')); if (!empty($aAlbumInfo) && $aAlbumInfo['Owner'] == $this->_iProfileId) { $aRes = array('status' => 'OK', 'album_uri' => $aAlbumInfo['Uri'], 'owner_name' => $sOwnerNick); } else { $aRes = array('status' => 'OK', 'album_uri' => uriFilter($sOwnerAlbum), 'owner_name' => $sOwnerNick); } require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php'; $oJSON = new Services_JSON(); $sCode = $oJSON->encode($aRes); } else { $sLangPref = '_' . $this->_oConfig->getMainPrefix(); if (!$this->_iProfileId || !$this->isAllowedAdd()) { $sKey = _t($sLangPref . '_access_denied'); $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1); } else { $sUrlPref = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(); $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(), 'album_view', array(), _t($sLangPref . '_album_view')); $aAlbumParams = array('owner' => $this->_iProfileId, 'show_empty' => TRUE, 'hide_default' => TRUE); $iAlbumsCount = $this->oAlbums->getAlbumCount($aAlbumParams); $aAlbums = array(); if ($iAlbumsCount) { $aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams); foreach ($aAlbumsList as $aAlbum) { $aAlbums[$aAlbum['ID']] = $aAlbum['Caption']; } } else { $aAlbums[time()] = $sOwnerAlbum; } $aForm = $this->getInstanceUploadFormArray($aAlbums, $aPrivFieldView); $oForm = new BxTemplFormView($aForm); $sCode = $this->_oTemplate->addJs(array('albums.js'), TRUE) . $oForm->getCode(); $sCode = $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $sCode)); $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => _t($sLangPref . '_upload_instance'), 'content' => $sCode)); $sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE); } } header('Content-Type: text/html; charset=UTF-8'); echo $sCode; exit; }