Пример #1
0
 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);
 }
Пример #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];
             }
         }
     }
 }
Пример #3
0
 function processing()
 {
     global $sModule;
     global $sFfmpegPath;
     global $sModulesPath;
     global $sFilesPath;
     $iFilesCount = getSettingValue($sModule, "processCount");
     if (!is_numeric($iFilesCount)) {
         $iFilesCount = 2;
     }
     $iFailedTimeout = getSettingValue($sModule, "failedTimeout");
     if (!is_numeric($iFailedTimeout)) {
         $iFailedTimeout = 1;
     }
     $iFailedTimeout *= 86400;
     $sDbPrefix = DB_PREFIX . ucfirst($sModule);
     $iCurrentTime = time();
     do {
         //remove all tokens older than 10 minutes
         if (!getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'")) {
             break;
         }
         if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . STATUS_FAILED . "' WHERE `Status`='" . STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'")) {
             break;
         }
         $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount);
         if (!$rResult) {
             break;
         }
         for ($i = 0; $i < mysql_num_rows($rResult); $i++) {
             $aFile = mysql_fetch_assoc($rResult);
             if (convertVideo($aFile['ID'])) {
                 $sType = 'bx_videos';
                 //album counter & cover update
                 if (getSettingValue($sModule, "autoApprove") == TRUE_VAL) {
                     $oAlbum = new BxDolAlbums($sType);
                     $oAlbum->updateObjCounterById($aFile['ID']);
                     if (getParam($oAlbum->sAlbumCoverParam) == 'on') {
                         $oAlbum->updateLastObjById($aFile['ID']);
                     }
                 }
                 //tags & categories parsing
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $aFile['ID']);
                 $oCateg = new BxDolCategories($aFile['Owner']);
                 $oCateg->reparseObjTags($sType, $aFile['ID']);
             } else {
                 if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'")) {
                     break;
                 }
             }
         }
     } while (false);
 }
 function getVideoAlbums($sUser, $sPwd, $sNick)
 {
     $iIdProfile = BxDolXMLRPCUtil::getIdByNickname($sNick);
     if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     // create user's default album if there is no one
     if ($sUser == $sNick) {
         $sCaption = str_replace('{nickname}', $sUser, getParam('bx_videos_profile_album_name'));
         bx_import('BxDolAlbums');
         $oAlbum = new BxDolAlbums('bx_videos');
         $aData = array('caption' => $sCaption, 'location' => _t('_bx_videos_undefined'), 'owner' => $iId, 'AllowAlbumView' => BX_DOL_PG_ALL);
         $oAlbum->addAlbum($aData);
     }
     return BxDolXMLRPCMedia::_getMediaAlbums('video', $iIdProfile, $iId, true);
 }
Пример #5
0
 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) {
             bx_import('BxDolAlbums');
             $isDefaulAlbum = $r['Uri'] == BxDolAlbums::getAbumUri(getParam($sType . '_profile_album_name'), $iIdProfile) ? 1 : 0;
         } else {
             $isDefaulAlbum = 1;
         }
         $aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount'], 'DefaultAlbum' => $isDefaulAlbum);
     }
     return $aRet;
 }
Пример #6
0
 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('BxDolAlbums');
     $o = new BxDolAlbums($sType, (int) $iIdProfile);
     $aList = $o->getAlbumList(array('owner' => (int) $iIdProfile, 'show_empty' => $isShowEmptyAlbums));
     $aRet = array();
     foreach ($aList as $r) {
         if ($iIdProfile != $iIdProfileViewer && !BxDolService::call($sModuleName, 'get_album_privacy', array((int) $r['ID'], $iIdProfileViewer), 'Search')) {
             continue;
         }
         $aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount']);
     }
     return $aRet;
 }
 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 = BxDolAlbums::getAbumUri($this->oConfig->getGlParam('profile_album_name'), $this->iOwnerId);
     $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'], '');
 }
Пример #8
0
 function _GenSendFileInfoForm($iFileID, $aDefaultValues = array(), $aPossibleImage = array(), $aPossibleDuration = array())
 {
     header("Content-type: text/html; charset=utf-8");
     $this->addJsTranslation(array('_bx_' . $this->sUploadTypeLC . 's_val_title_err', '_bx_' . $this->sUploadTypeLC . 's_val_descr_err'));
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aFormCategories['categories'] = $oCategories->getGroupChooser('bx_' . $this->sUploadTypeLC . 's', $this->_iOwnerId, true);
     $aFormCategories['categories']['required'] = false;
     $sKey = 'album';
     $aAlbums = array();
     if ($this->_aExtras[$sKey] != '') {
         $aAlbums[BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => stripslashes($this->_aExtras[$sKey]));
     } else {
         $oAlbum = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's');
         $aAlbumList = $oAlbum->getAlbumList(array('owner' => $this->_iOwnerId));
         if (count($aAlbumList) > 0) {
             foreach ($aAlbumList as $aValue) {
                 $aList[$aValue['ID']] = stripslashes($aValue['Caption']);
             }
         } else {
             $sDefName = $oAlbum->getAlbumDefaultName();
             $aList[$sDefName] = stripslashes($sDefName);
         }
         $aAlbums['album'] = array('type' => 'select_box', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'caption' => _t('_sys_album'), 'values' => $aList);
     }
     $sCaptionVal = $this->sSendFileInfoFormCaption != '' ? $this->sSendFileInfoFormCaption : _t('_Info');
     // processing of possible default values
     $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC);
     foreach ($aInputValues as $sField) {
         $sEmpty = $sField == 'type' ? 'upload' : '';
         $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty;
         $aDefaultValues[$sField] = $sTemp;
     }
     $aForm = array('form_attrs' => array('id' => $this->sUploadTypeLC . '_file_info_form', 'method' => 'post', 'action' => $this->sWorkingFile, 'target' => 'upload_file_info_frame_' . $iFileID), 'inputs' => array('header2' => array('type' => 'block_header', 'caption' => $sCaptionVal, 'collapsable' => false), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'required' => true, 'value' => $aDefaultValues['title']), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aDefaultValues['tags']), 'description' => array('type' => 'textarea', 'name' => 'description', 'caption' => _t('_Description'), 'value' => $aDefaultValues['description']), 'media_id' => array('type' => 'hidden', 'name' => 'file_id', 'value' => $iFileID), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'accept_file_info'), $this->sUploadTypeLC => array('type' => 'hidden', 'name' => $this->sUploadTypeLC, 'value' => $aDefaultValues[$this->sUploadTypeLC]), 'type' => array('type' => 'hidden', 'name' => 'type', 'value' => $aDefaultValues['type'])));
     //--- Process Extras ---//
     foreach ($this->_aExtras as $sKey => $mixedValue) {
         $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => $mixedValue);
     }
     // merging categories
     $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums));
     if (is_array($aPossibleImage) && count($aPossibleImage) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage);
     }
     if (is_array($aPossibleDuration) && count($aPossibleDuration) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration);
     }
     $aForm['inputs'][] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'upload', 'value' => _t('_Submit'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');")), 1 => array('type' => 'button', 'name' => 'delete', 'value' => _t('_bx_' . $this->sUploadTypeLC . 's_admin_delete'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . $this->sWorkingFile . "'); ")));
     $oForm = new BxTemplFormView($aForm);
     $sForm = $this->parseHtmlByName('uploader_regular_info.html', array('id' => $iFileID, 'form' => $oForm->getCode()));
     $sForm = str_replace(array("'", "\r", "\n"), array("\\'"), $sForm);
     return "<script src='" . BX_DOL_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sForm . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>";
 }
 function getAlbumList($iPage = 1, $iPerPage = 10, $aCond = array())
 {
     $oSet = new BxDolAlbums($this->aCurrent['name']);
     foreach ($this->aCurrent['restriction'] as $sKey => $aParam) {
         if (!empty($aParam['value'])) {
             $aData[$sKey] = $aParam['value'];
         }
     }
     $aData = array_merge($aData, $aCond);
     $iAlbumCount = $oSet->getAlbumCount($aData);
     $this->aCurrent['paginate']['totalAlbumNum'] = $iAlbumCount;
     if ($iAlbumCount > 0) {
         $sCode = $this->addCustomParts();
         $aList = $oSet->getAlbumList($aData, (int) $iPage, (int) $iPerPage);
         $bCheckPrivacy = isset($aData['allow_view']) ? false : true;
         foreach ($aList as $aData) {
             $sCode .= $this->displayAlbumUnit($aData, $bCheckPrivacy);
         }
     } else {
         $sCode = MsgBox(_t('_Empty'));
     }
     $sCode .= $this->addAlbumJsCss($this->bDynamic);
     return $this->oTemplate->parseHtmlByName('album_units.html', array('content' => $sCode));
 }
Пример #10
0
 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;
 }
Пример #11
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);
     }
 }
Пример #12
0
 function getPhotoBlock($aParams = array())
 {
     $this->aCurrent['paginate']['perPage'] = 20;
     $aShowParams = array('showScroller' => 0, '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 'DisplayScroller':
                     $aShowParams['showScroller'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayRate':
                     $aShowParams['showRate'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayPagination':
                     $aShowParams['showPaginate'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayViews':
                     $aShowParams['showViews'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayWhenAgo':
                     $aShowParams['showDate'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayLink':
                     $aShowParams['showLink'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'DisplayProfile':
                     $aShowParams['showFrom'] = $sKeyValue == 1 ? 1 : 0;
                     break;
                 case 'LinkUnitTo':
                     $aShowParams['linkUnitTo'] = $sKeyValue;
                     break;
             }
         }
     }
     $aFilesList = $this->getSearchData();
     $iCnt = $this->aCurrent['paginate']['totalNum'];
     if ($iCnt) {
         $aUnit = array();
         $aUnits = array();
         if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) {
             $iPhotoWidth = 259;
             $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['count'] = $iCnt;
         $aUnit['picWidth'] = $iPhotoWidth;
         $aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2;
         $aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 2;
         $aUnit['bx_if:show_scroller'] = array('condition' => false, 'content' => array());
         if ((int) $aShowParams['showScroller'] == 1) {
             $bScroller = false;
             $iContainerWidth = $iContentWidth = $iCnt * 40;
             if ($iContentWidth > $aUnit['picWidth']) {
                 $bScroller = true;
                 $iContainerWidth = $aUnit['picBoxWidth'] - 72;
             }
             $aUnit['bx_if:show_scroller'] = array('condition' => true, 'content' => array('switchWidthOut' => $aUnit['switchWidthOut'], 'containerWidth' => $iContainerWidth, 'contWidth' => $iContentWidth, 'bx_if:scrollerBack' => array('condition' => $bScroller, 'content' => array(1)), 'bx_repeat:iconBlock' => $aUnits, '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'], '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 bx-def-padding-sec-left bx-def-padding-sec-right">
             <div class="view_all">
                 <a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a>
             </div>
          </div>
         <?php 
         $sCode = ob_get_clean();
         bx_import('BxDolAlbums');
         $sCaption = BxDolAlbums::getAbumUri($this->oModule->_oConfig->getGlParam('profile_album_name'), $this->oModule->_iProfileId);
         $sLinkTitle = _t('_bx_photos_add');
         return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, array('lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . getUsername($this->oModule->_iProfileId), 'lnk_title' => $sLinkTitle, 'lnk_content' => $sLinkTitle));
     }
     return MsgBox(_t('_Empty'));
 }
Пример #13
0
 function serviceGetAlbumUploaderUrl($iProfileId, $sSelectedAlbum = '')
 {
     bx_import('BxDolAlbums');
     $aDefaultAlbums = $this->_oConfig->getDefaultAlbums();
     if (!empty($sSelectedAlbum) && in_array($sSelectedAlbum, $aDefaultAlbums)) {
         $sSelectedAlbum = BxDolAlbums::getAbumUri($this->_oConfig->getGlParam($sSelectedAlbum), $iProfileId);
     }
     return BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sSelectedAlbum . '/owner/' . getUsername($iProfileId);
 }
Пример #14
0
 function getAlbumList($iPage = 1, $iPerPage = 10, $aCond = array())
 {
     $oSet = new BxDolAlbums($this->aCurrent['name']);
     foreach ($this->aCurrent['restriction'] as $sKey => $aParam) {
         $aData[$sKey] = $aParam['value'];
     }
     $aData = array_merge($aData, $aCond);
     $iAlbumCount = $oSet->getAlbumCount($aData);
     if ($iAlbumCount > 0) {
         $this->aCurrent['paginate']['totalAlbumNum'] = $iAlbumCount;
         $sCode = $this->addCustomParts();
         $aList = $oSet->getAlbumList($aData, (int) $iPage, (int) $iPerPage);
         foreach ($aList as $iKey => $aData) {
             $sCode .= $this->displayAlbumUnit($aData);
         }
     } else {
         $sCode = MsgBox(_t('_Empty'));
     }
     return $sCode;
 }
Пример #15
0
 public static function getAbumUri($sName, $iUserId)
 {
     return uriFilter(BxDolAlbums::getAbumName($sName, $iUserId));
 }
Пример #16
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));
 }