function getBlockCode_ViewAlbum()
 {
     $oAlbum = new BxDolAlbums($this->oConfig->getMainPrefix());
     $aAlbum = $oAlbum->getAlbumInfo(array('fileId' => $this->aFileInfo['albumId']));
     $aAlbum['show_as_list'] = true;
     return array($this->oSearch->displayAlbumUnit($aAlbum), array(), array(), false);
 }
Example #2
0
 function BxBaseAlbumForm($sType, $iAlbum = 0)
 {
     $this->iOwnerId = (int) $_COOKIE['memberID'];
     if ($this->iOwnerId == 0) {
         return;
     }
     $this->iAlbumId = (int) $iAlbum;
     $this->sType = strip_tags($sType);
     $oPrivacy = new BxDolPrivacy('sys_albums', 'ID', 'Owner');
     $aPrivField = $oPrivacy->getGroupChooser($this->iOwnerId, 'sys_albums', 'view');
     $this->aForm = array('form_attrs' => array('name' => 'form_album', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_albums', 'key' => 'ID', 'uri' => 'Uri', 'uri_title' => 'Caption', 'submit_name' => 'save')), 'inputs' => array('Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => _t('_sys_album_caption_capt'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_sys_album_err_capt')), 'db' => array('pass' => 'Xss'), 'display' => true), 'Location' => array('type' => 'text', 'name' => 'Location', 'caption' => _t('_sys_album_caption_loc'), 'db' => array('pass' => 'Xss'), 'display' => true), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_sys_album_caption_desc'), 'required' => true, 'html' => false, 'checker' => array('func' => 'length', 'params' => array(3, 255), 'error' => _t('_sys_album_err_desc')), 'db' => array('pass' => 'Xss')), 'allow_view_to' => $aPrivField, 'Type' => array('type' => 'hidden', 'name' => 'Type', 'db' => array('pass' => 'Xss'), 'value' => $this->sType), 'Control' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'save', 'value' => _t("_sys_album_create")), 1 => array('type' => 'reset', 'name' => 'cancel', 'value' => _t("_sys_album_cancel")))));
     $iAlbum = (int) $iAlbum;
     if ($this->iAlbumId > 0) {
         $oAlbum = new BxDolAlbums($this->sType);
         $this->aInfo = $oAlbum->getAlbumInfo(array('fileId' => $iAlbum));
         if ($this->iOwnerId != $this->aInfo['Owner']) {
             return;
         }
         $this->aForm['inputs']['Control'] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'save', 'value' => _t("_sys_album_save_changes")), 1 => array('type' => 'submit', 'name' => 'delete', 'value' => _t("_sys_album_delete")), 2 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_add")), 3 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_edit_items")), 4 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_organize")), 5 => array('type' => 'reset', 'name' => 'cancel', 'value' => _t("_sys_album_cancel")));
         foreach ($this->aForm['inputs'] as $sKey => $aValue) {
             if ($sKey != 'Control') {
                 $this->aForm['inputs'][$sKey]['value'] = $this->aInfo[$sKey];
             }
         }
     }
 }
 function _updateExtraParams($aExtra, $iFileId, $iAuthorId)
 {
     $aFile = $this->oModule->_oDb->getFileInfo(array('fileId' => $iFileId));
     if (empty($aFile)) {
         return $aExtra;
     }
     $oAlbums = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's', $iAuthorId);
     $aAlbum = $oAlbums->getAlbumInfo(array('fileId' => $aFile['albumId'], 'owner' => $iAuthorId));
     if (empty($aAlbum)) {
         return $aExtra;
     }
     $aExtra['privacy_view'] = $aAlbum['AllowAlbumView'];
     if (!isset($aExtra['album'])) {
         $aExtra['album'] = $aAlbum['Uri'];
     }
     return $aExtra;
 }
 function getWallPostOutline($aEvent, $sIcon = 'save', $aParams = array())
 {
     $sPrefix = $this->_oConfig->getMainPrefix();
     $sPrefixAlbum = $sPrefix . '_albums';
     $aOwner = getProfileInfo((int) $aEvent['owner_id']);
     $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
     rsort($aObjectIds);
     $iItems = count($aObjectIds);
     $iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int) $aParams['grouped']['items_limit'] : 3;
     if ($iItems > $iItemsLimit) {
         $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
     }
     $bSave = false;
     $aContent = array();
     if (!empty($aEvent['content'])) {
         $aContent = unserialize($aEvent['content']);
     }
     if (!isset($aContent['idims'])) {
         $aContent['idims'] = array();
     }
     $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
     bx_import('Search', $this->_aModule);
     $oSearch = new $sClassName();
     $sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse';
     $iDeleted = 0;
     $aItems = $aTmplItems = array();
     foreach ($aObjectIds as $iId) {
         $aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType);
         if (empty($aItem)) {
             $iDeleted++;
         } else {
             if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'], $this->oModule->_iProfileId)) {
                 if (!isset($aContent['idims'][$iId])) {
                     $sPath = isset($aItem['file_path']) && file_exists($aItem['file_path']) ? $aItem['file_path'] : $aItem['file'];
                     $aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath);
                     $bSave = true;
                 }
                 $aItem['dims'] = $aContent['idims'][$iId];
                 $aItems[] = $aItem;
                 $aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x');
                 $aTmplItems[] = array_merge($aItem, array('mod_prefix' => $sPrefix, 'item_width' => $aItem['dims']['w'], 'item_height' => $aItem['dims']['h'], 'item_icon' => $aItem['file'], 'item_icon_2x' => !empty($aItem2x['file']) ? $aItem2x['file'] : $aItem['file'], 'item_page' => $aItem['url'], 'item_title' => $aItem['title']));
             }
         }
     }
     if ($iDeleted == count($aObjectIds)) {
         return array('perform_delete' => true);
     }
     if (empty($aOwner) || empty($aItems)) {
         return "";
     }
     $aResult = array();
     if ($bSave) {
         $aResult['save']['content'] = serialize($aContent);
     }
     $sCss = "";
     if ($aEvent['js_mode']) {
         $sCss = $this->_oTemplate->addCss('wall_outline.css', true);
     } else {
         $this->_oTemplate->addCss('wall_outline.css');
     }
     $iOwner = (int) $aEvent['owner_id'];
     $sOwner = getNickName($iOwner);
     $sOwnerLink = getProfileLink($iOwner);
     //--- Grouped events
     $iItems = count($aItems);
     if ($iItems > 1) {
         $aExtra = unserialize($aEvent['content']);
         $sAlbumUri = $aExtra['album'];
         $oAlbum = new BxDolAlbums($sPrefix);
         $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner));
         $oAlbumCmts = new BxTemplCmtsView($sPrefixAlbum, $aAlbumInfo['ID']);
         $aAlbumInfo['comments_count'] = (int) $oAlbumCmts->getObjectCommentsCount();
         $aAlbumInfo['Url'] = $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'], $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner);
         $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|outline_item_image_grouped.html';
         $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => $aAlbumInfo['Url'], 'album_title' => $aAlbumInfo['Caption'], 'album_description' => strmaxtextlen($aAlbumInfo['Description'], 200), 'album_comments' => (int) $aAlbumInfo['comments_count'] > 0 ? _t('_wall_n_comments', $aAlbumInfo['comments_count']) : _t('_wall_no_comments'), 'album_comments_link' => $aAlbumInfo['Url'] . '#cmta-' . $sPrefixAlbum . '-' . $aAlbumInfo['ID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']));
         return $aResult;
     }
     //--- Single public event
     $aItem = $aItems[0];
     $aTmplItem = $aTmplItems[0];
     $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|outline_item_image.html';
     $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem['url'], 'item_title' => $aItem['title'], 'item_description' => strmaxtextlen($aItem['description'], 200), 'item_comments' => (int) $aItem['comments_count'] > 0 ? _t('_wall_n_comments', $aItem['comments_count']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['url'] . '#cmta-' . $sPrefix . '-' . $aItem['id'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])));
     return $aResult;
 }
Example #5
0
 function serviceProfilePhotoBlock($aParams)
 {
     $this->aCurrent['sorting'] = 'album_order';
     $sCaption = str_replace('{nickname}', getNickName($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('_' . $this->oModule->_oConfig->getMainPrefix() . '_undefined'), 'owner' => $this->oModule->_iProfileId, 'AllowAlbumView' => BX_DOL_PG_ALL);
         $aAlbumInfo['ID'] = $oAlbum->addAlbum($aData, false);
     }
     if ($this->oModule->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->oModule->_iProfileId)) {
         $this->aCurrent['restriction']['album'] = array('value' => $sUri, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
         return $this->getPhotoBlock($aParams);
     }
 }
 function getProfilePhoto($aParams)
 {
     $iProfileId = !empty($aParams['profile_id']) ? (int) $aParams['profile_id'] : 0;
     $sAlbum = !empty($aParams['album']) ? $aParams['album'] : 'profile_album_name';
     $sType = !empty($aParams['type']) ? $aParams['type'] : 'icon';
     $sReturnType = !empty($aParams['return_type']) ? $aParams['return_type'] : 'link';
     $aDefaultAlbums = $this->oModule->_oConfig->getDefaultAlbums();
     if (!empty($sAlbum) && in_array($sAlbum, $aDefaultAlbums)) {
         bx_import('BxDolAlbums');
         $sAlbum = BxDolAlbums::getAbumUri($this->oModule->_oConfig->getGlParam($sAlbum), $iProfileId);
     }
     $oAlbum = new BxDolAlbums('bx_photos');
     $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbum, 'owner' => $iProfileId), array('ID'));
     if (!$this->oModule->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], getLoggedId())) {
         return '';
     }
     $sKeywordGet = $sKeywordPost = null;
     if (isset($_GET['keyword'])) {
         $sKeywordGet = $_GET['keyword'];
         unset($_GET['keyword']);
     } elseif (isset($_POST['keyword'])) {
         $sKeywordPost = $_POST['keyword'];
         unset($_POST['keyword']);
     }
     $aSavePaginate = array();
     if (isset($_GET['page'], $_GET['per_page'])) {
         $aSavePaginate = array($_GET['page'], $_GET['per_page']);
     }
     unset($_GET['page']);
     unset($_GET['per_page']);
     $this->aCurrent['paginate']['perPage'] = 1;
     $this->aCurrent['paginate']['page'] = 1;
     $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
     $this->aCurrent['sorting'] = 'album_order';
     $this->aCurrent['restriction']['album'] = array('value' => $sAlbum, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
     $aFilesList = $this->getSearchData();
     if (!empty($aSavePaginate)) {
         list($_GET['page'], $_GET['per_page']) = $aSavePaginate;
     }
     if (!is_null($sKeywordGet)) {
         $_GET['keyword'] = clear_xss($sKeywordGet);
     } elseif (!is_null($sKeywordPost)) {
         $_POST['keyword'] = clear_xss($sKeywordPost);
     }
     if (!$this->aCurrent['paginate']['totalNum']) {
         return '';
     }
     $aFile = array_pop($aFilesList);
     $aFile['file_url'] = $this->getImgUrl($aFile['Hash'], $sType);
     $aFile['view_url'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri() . 'view/' . $aFile['uri'];
     if ($sReturnType == 'full') {
         return $aFile;
     }
     return $aFile['file_url'];
 }
Example #7
0
 function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
 {
     $bAlbumView = false;
     if ($sParamName == 'album' && $sParamValue1 == 'owner') {
         $bAlbumView = true;
         $GLOBALS['oTopMenu']->setCustomSubHeader($sParamValue);
         $oAlbums = new BxDolAlbums($this->_oConfig->getMainPrefix());
         $aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2)), array('ID', 'Caption', 'Owner', 'AllowAlbumView'));
         $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']);
     }
     if (!empty($aAlbumInfo) && $aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getNickName($this->_iProfileId)) {
         $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
         return;
     }
     if ($bAlbumView && !empty($aAlbumInfo['AllowAlbumView']) && !$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) {
         $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
         $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
         $this->aPageTmpl['header'] = $sKey;
         $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
         return;
     }
     $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
     require_once 'BxFilesSearch.php';
     $oSearch = new BxFilesSearch($sParamName, $sParamValue, $sParamValue1, $sParamValue2);
     $sRss = bx_get('rss');
     if ($sRss !== false && $sRss) {
         $oSearch->aCurrent['paginate']['perPage'] = 10;
         echo $oSearch->rss();
         exit;
     }
     $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all';
     $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix);
     if (strlen($sParamName) > 0 && strlen($sParamValue) > 0 && isset($oSearch->aCurrent['restriction'][$sParamName])) {
         $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue;
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $sParamValue);
     }
     if ($bAlbumView) {
         $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']);
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']);
     }
     if ($sParamName == 'calendar') {
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT);
     }
     $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all');
     $sCode = $oSearch->displayResultBlock();
     if ($oSearch->aCurrent['paginate']['totalNum'] > 0) {
         $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
         $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
         foreach ($aAdd as $sValue) {
             if (strlen($sValue) > 0) {
                 $sArg .= '/' . $sValue;
             } else {
                 break;
             }
         }
         $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg;
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_per_page' => 'return !loadDynamicBlock(1, \'' . $sLink . '&page=1&per_page=\' + this.value);'));
         $sPaginate = $oPaginate->getPaginate();
     } else {
         $sCode = MsgBox(_t('_Empty'));
     }
     $aMenu = array();
     $sCode = DesignBoxContent($sCaption, $sCode, 1);
     $this->aPageTmpl['css_name'] = array('browse.css');
     $this->aPageTmpl['header'] = $sCaption;
     $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
 }