BxAlbumsModule.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Albums Albums
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolAcl');
  12. /**
  13. * Albums module
  14. */
  15. class BxAlbumsModule extends BxBaseModTextModule
  16. {
  17. protected $_aContexts = array('popular', 'public', 'author');
  18. function __construct(&$aModule)
  19. {
  20. parent::__construct($aModule);
  21. }
  22. public function serviceGetSafeServices()
  23. {
  24. $a = parent::serviceGetSafeServices();
  25. return array_merge($a, array (
  26. 'EntityAddFiles' => '',
  27. 'MediaComments' => '',
  28. 'BrowseRecentMedia' => '',
  29. 'BrowseFeaturedMedia' => '',
  30. 'BrowsePopularMedia' => '',
  31. 'BrowseTopMedia' => '',
  32. 'BrowseFavoriteMedia' => '',
  33. ));
  34. }
  35. /**
  36. * Entry actions and social sharing block
  37. */
  38. public function serviceEntityAllActions ($mixedContent = false, $aParams = array())
  39. {
  40. if(!empty($mixedContent)) {
  41. if(!is_array($mixedContent))
  42. $mixedContent = array((int)$mixedContent, array());
  43. }
  44. else {
  45. $mixedContent = $this->_getContent();
  46. if($mixedContent === false)
  47. return false;
  48. }
  49. list($iContentId, $aContentInfo) = $mixedContent;
  50. $aMedias = $this->_oDb->getMediaListByContentId($iContentId);
  51. if(!empty($aMedias) && is_array($aMedias)) {
  52. $aMedia = array_shift($aMedias);
  53. if(!empty($aMedia['file_id']))
  54. $aParams = array_merge(array(
  55. 'entry_thumb' => $aMedia['file_id']
  56. ), $aParams);
  57. }
  58. return parent::serviceEntityAllActions(array($iContentId, $aContentInfo), $aParams);
  59. }
  60. /**
  61. * @page service Service Calls
  62. * @section bx_albums Albums
  63. * @subsection bx_albums-forms Forms
  64. * @subsubsection bx_albums-entity_add_files entity_add_files
  65. *
  66. * @code bx_srv('bx_albums', 'entity_add_files', [...]); @endcode
  67. *
  68. * Display form for adding media to the album.
  69. * @param $iContentId album content id where media will be added, if it's not provided then it's determined from 'id' GET variable
  70. * @return HTML string with form, all necessary CSS and JS files are automatically added to the HEAD section of the site HTML. On error false or empty string is returned.
  71. *
  72. * @see BxAlbumsModule::serviceEntityAddFiles
  73. */
  74. /**
  75. * @ref bx_albums-entity_add_files "entity_add_files"
  76. */
  77. public function serviceEntityAddFiles ($iContentId = 0)
  78. {
  79. return $this->_serviceEntityForm ('editDataForm', $iContentId, 'bx_albums_entry_add_images');
  80. }
  81. /**
  82. * Delete file and album association, also file views, votes, comments, meta data are also deleted
  83. * @param $iFileId file ID
  84. * @return true on success of false on error
  85. */
  86. public function serviceDeleteFileAssociations($iFileId)
  87. {
  88. $CNF = &$this->_oConfig->CNF;
  89. if (!($aMediaInfo = $this->_oDb->getMediaInfoSimpleByFileId($iFileId))) // file is already deleted
  90. return true;
  91. if (!$this->_oDb->deassociateFileWithContent(0, $iFileId))
  92. return false;
  93. $aContentInfo = $this->_oDb->getContentInfoById($aMediaInfo['content_id']);
  94. $iSender = isLogged() ? bx_get_logged_profile_id() : $aMediaInfo['author'];
  95. $iAuthor = isset($aContentInfo[$CNF['FIELD_AUTHOR']]) ? $aContentInfo[$CNF['FIELD_AUTHOR']] : $aMediaInfo['author'];
  96. bx_alert($this->getName(), 'media_deleted', $aMediaInfo['content_id'], $iSender, array(
  97. 'object_author_id' => $iAuthor,
  98. 'subobject_id' => $aMediaInfo['id'],
  99. 'media_id' => $aMediaInfo['id'],
  100. 'media_info' => $aMediaInfo,
  101. ));
  102. bx_alert($this->getName() . '_media', 'deleted', $aMediaInfo['id'], $iSender, array(
  103. 'object_id' => $aMediaInfo['content_id'],
  104. 'object_author_id' => $iAuthor,
  105. 'media_info' => $aMediaInfo,
  106. ));
  107. if (!empty($CNF['OBJECT_VIEWS_MEDIA'])) {
  108. $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS_MEDIA'], $aMediaInfo['id']);
  109. if ($o) $o->onObjectDelete();
  110. }
  111. if (!empty($CNF['OBJECT_VOTES_MEDIA'])) {
  112. $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_MEDIA'], $aMediaInfo['id']);
  113. if ($o) $o->onObjectDelete();
  114. }
  115. if (!empty($CNF['OBJECT_SCORES_MEDIA'])) {
  116. $o = BxDolScore::getObjectInstance($CNF['OBJECT_SCORES_MEDIA'], $aMediaInfo['id']);
  117. if ($o) $o->onObjectDelete();
  118. }
  119. if (!empty($CNF['OBJECT_COMMENTS_MEDIA'])) {
  120. $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS_MEDIA'], $aMediaInfo['id']);
  121. if ($o) $o->onObjectDelete();
  122. }
  123. if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) {
  124. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']);
  125. $oMetatags->onDeleteContent($aMediaInfo['id']);
  126. }
  127. if (!empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) {
  128. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']);
  129. $oMetatags->onDeleteContent($aMediaInfo['id']);
  130. }
  131. return true;
  132. }
  133. /**
  134. * Display media EXIF information.
  135. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  136. * @return HTML string with EXIF info. On error empty string is returned.
  137. */
  138. public function serviceMediaExif ($iMediaId = 0)
  139. {
  140. return $this->_serviceTemplateFunc ('mediaExif', $iMediaId, 'getMediaInfoById');
  141. }
  142. /**
  143. * @page service Service Calls
  144. * @section bx_albums Albums
  145. * @subsection bx_albums-page_blocks Page Blocks
  146. * @subsubsection bx_albums-media_comments media_comments
  147. *
  148. * @code bx_srv('bx_albums', 'media_comments', [...]); @endcode
  149. *
  150. * Display media comments block.
  151. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  152. * @return HTML string with comments. On error false or empty string is returned.
  153. *
  154. * @see BxAlbumsModule::serviceMediaComments
  155. */
  156. /**
  157. * @ref bx_albums-media_comments "media_comments"
  158. */
  159. public function serviceMediaComments ($iMediaId = 0)
  160. {
  161. return $this->_entityComments($this->_oConfig->CNF['OBJECT_COMMENTS_MEDIA'], $iMediaId);
  162. }
  163. /**
  164. * Display media author block.
  165. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  166. * @return HTML string with block content. On error false or empty string is returned.
  167. */
  168. public function serviceMediaAuthor ($iMediaId = 0)
  169. {
  170. return $this->_serviceTemplateFunc ('mediaAuthor', $iMediaId, 'getMediaInfoById');
  171. }
  172. /**
  173. * Entry actions and social sharing block
  174. */
  175. public function serviceMediaAllActions ($mixedContent = false, $aParams = array())
  176. {
  177. $iMediaId = 0;
  178. $aMediaInfo = array();
  179. $bContent = !empty($mixedContent);
  180. if($bContent && is_array($mixedContent))
  181. list($iMediaId, $aMediaInfo) = $mixedContent;
  182. else {
  183. if($bContent)
  184. $iMediaId = (int)$mixedContent;
  185. else
  186. $iMediaId = bx_process_input(bx_get('id'), BX_DATA_INT);
  187. if(!$iMediaId)
  188. return false;
  189. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  190. }
  191. if(!$iMediaId || !$aMediaInfo)
  192. return false;
  193. $CNF = &$this->_oConfig->CNF;
  194. return parent::serviceEntityAllActions (array($iMediaId, $aMediaInfo), array_merge(array(
  195. 'object_menu' => $CNF['OBJECT_MENU_ACTIONS_VIEW_MEDIA_ALL'],
  196. 'object_transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_BIG'],
  197. 'entry_url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_MEDIA'] . '&id=' . $iMediaId),
  198. 'entry_title' => $aMediaInfo['title'],
  199. 'entry_thumb' => $aMediaInfo['file_id']
  200. ), $aParams));
  201. }
  202. /**
  203. * Entry actions block
  204. */
  205. public function serviceMediaActions ($iContentId = 0)
  206. {
  207. $iContentId = $this->_getContent($iContentId, false);
  208. if($iContentId === false)
  209. return false;
  210. $oMenu = BxTemplMenu::getObjectInstance($this->_oConfig->CNF['OBJECT_MENU_ACTIONS_VIEW_MEDIA']);
  211. return $oMenu ? $oMenu->getCode() : false;
  212. }
  213. /**
  214. * Display media social sharing buttons block.
  215. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  216. * @return HTML string with block content. On error false or empty string is returned.
  217. */
  218. public function serviceMediaSocialSharing ($iMediaId = 0)
  219. {
  220. if(!$iMediaId)
  221. $iMediaId = bx_process_input(bx_get('id'), BX_DATA_INT);
  222. if(!$iMediaId)
  223. return false;
  224. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  225. if(!$aMediaInfo)
  226. return false;
  227. $CNF = &$this->_oConfig->CNF;
  228. return $this->serviceEntitySocialSharing(array($iMediaId, $aMediaInfo), array(
  229. 'uri' => $CNF['URI_VIEW_MEDIA'],
  230. 'title' => $aMediaInfo['title'],
  231. 'id_thumb' => $aMediaInfo['file_id'],
  232. 'object_transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_BIG']
  233. ));
  234. }
  235. /**
  236. * Display media preview block.
  237. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  238. * @param $mixedContext current context to navigate to next and previous file, possible values: popular, public, author. If omitted then value from 'context' GTE variable is taken. Default context is 'album' - when nothin is specified.
  239. * @param $aParams array of additional params.
  240. * @return HTML string with block content. On error false or empty string is returned.
  241. */
  242. public function serviceMediaView ($iMediaId = 0, $mixedContext = false, $aParams = array())
  243. {
  244. if(!$iMediaId)
  245. $iMediaId = bx_process_input(bx_get('id'), BX_DATA_INT);
  246. if(!$iMediaId)
  247. return false;
  248. if(!$mixedContext) {
  249. $mixedContext = bx_process_input(bx_get('context'));
  250. if(!in_array($mixedContext, $this->_aContexts)) // when no context specified, it is assumed that it is an album context
  251. $mixedContext = bx_process_input($mixedContext, BX_DATA_INT); // numeric context is reserved for future use
  252. }
  253. $aParams['context'] = $mixedContext;
  254. $iAutoplay = 0;
  255. if(!isset($aParams['autoplay']) && ($iAutoplay = bx_get('autoplay')) !== false)
  256. $aParams['autoplay'] = (int)$iAutoplay;
  257. return $this->_oTemplate->entryMediaView ($iMediaId, $aParams);
  258. }
  259. public function checkAllowedSetThumb ($iContentId = 0)
  260. {
  261. return CHECK_ACTION_RESULT_NOT_ALLOWED;
  262. }
  263. /**
  264. * @page service Service Calls
  265. * @section bx_albums Albums
  266. * @subsection bx_albums-browse Browse
  267. * @subsubsection bx_albums-browse_recent_media browse_recent_media
  268. *
  269. * @code bx_srv('bx_albums', 'browse_recent_media', [...]); @endcode
  270. *
  271. * Display block for browsing recently uploaded media files.
  272. * @param $sUnitView unit view mode: gallery
  273. * @param $bDisplayEmptyMsg display 'empty' message when nothing to browse, or return empty string.
  274. * @param $bAjaxPaginate use AJAX or regular paginate.
  275. * @return HTML string with block content. On error false or empty string is returned.
  276. *
  277. * @see BxAlbumsModule::serviceBrowseRecentMedia
  278. */
  279. /**
  280. * @ref bx_albums-browse_recent_media "browse_recent_media"
  281. */
  282. public function serviceBrowseRecentMedia ($sUnitView = false, $bDisplayEmptyMsg = true, $bAjaxPaginate = true)
  283. {
  284. return $this->_serviceBrowse ('recent', array('unit_view' => $sUnitView), BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate, 'SearchResultMedia');
  285. }
  286. /**
  287. * @page service Service Calls
  288. * @section bx_albums Albums
  289. * @subsection bx_albums-browse Browse
  290. * @subsubsection bx_albums-browse_featured_media browse_featured_media
  291. *
  292. * @code bx_srv('bx_albums', 'browse_featured_media', [...]); @endcode
  293. *
  294. * Display featured media.
  295. * @param $sUnitView unit view mode: gallery
  296. * @param $bDisplayEmptyMsg display 'empty' message when nothing to browse, or return empty string.
  297. * @param $bAjaxPaginate use AJAX or regular paginate.
  298. * @return HTML string with block content. On error false or empty string is returned.
  299. *
  300. * @see BxAlbumsModule::serviceBrowseFeaturedMedia
  301. */
  302. /**
  303. * @ref bx_albums-browse_featured_media "browse_featured_media"
  304. */
  305. public function serviceBrowseFeaturedMedia ($sUnitView = false, $bDisplayEmptyMsg = false, $bAjaxPaginate = true)
  306. {
  307. return $this->_serviceBrowse ('featured', array('unit_view' => $sUnitView), BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate, 'SearchResultMedia');
  308. }
  309. /**
  310. * @page service Service Calls
  311. * @section bx_albums Albums
  312. * @subsection bx_albums-browse Browse
  313. * @subsubsection bx_albums-browse_popular_media browse_popular_media
  314. *
  315. * @code bx_srv('bx_albums', 'browse_popular_media', [...]); @endcode
  316. *
  317. * Display popular media.
  318. * @param $sUnitView unit view mode: gallery
  319. * @param $bDisplayEmptyMsg display 'empty' message when nothing to browse, or return empty string.
  320. * @param $bAjaxPaginate use AJAX or regular paginate.
  321. * @return HTML string with block content. On error false or empty string is returned.
  322. *
  323. * @see BxAlbumsModule::serviceBrowsePopularMedia
  324. */
  325. /**
  326. * @ref bx_albums-browse_popular_media "browse_popular_media"
  327. */
  328. public function serviceBrowsePopularMedia ($sUnitView = false, $bDisplayEmptyMsg = true, $bAjaxPaginate = true)
  329. {
  330. return $this->_serviceBrowse ('popular', array('unit_view' => $sUnitView), BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate, 'SearchResultMedia');
  331. }
  332. /**
  333. * @page service Service Calls
  334. * @section bx_albums Albums
  335. * @subsection bx_albums-browse Browse
  336. * @subsubsection bx_albums-browse_top_media browse_top_media
  337. *
  338. * @code bx_srv('bx_albums', 'browse_top_media', [...]); @endcode
  339. *
  340. * Display top media.
  341. * @param $sUnitView unit view mode: gallery
  342. * @param $bDisplayEmptyMsg display 'empty' message when nothing to browse, or return empty string.
  343. * @param $bAjaxPaginate use AJAX or regular paginate.
  344. * @return HTML string with block content. On error false or empty string is returned.
  345. *
  346. * @see BxAlbumsModule::serviceBrowseTopMedia
  347. */
  348. /**
  349. * @ref bx_albums-browse_top_media "browse_top_media"
  350. */
  351. public function serviceBrowseTopMedia ($sUnitView = false, $bDisplayEmptyMsg = true, $bAjaxPaginate = true)
  352. {
  353. return $this->_serviceBrowse ('top', array('unit_view' => $sUnitView), BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate, 'SearchResultMedia');
  354. }
  355. /**
  356. * @page service Service Calls
  357. * @section bx_albums Albums
  358. * @subsection bx_albums-browse Browse
  359. * @subsubsection bx_albums-browse_favorite_media browse_favorite_media
  360. *
  361. * @code bx_srv('bx_albums', 'browse_favorite_media', [...]); @endcode
  362. *
  363. * Display favorite media for particular profile.
  364. * @param $iProfileId profile ID, if omitted then 'profile_id' GET variable is used
  365. * @param $aParams additional params for browsing such as 'unit_view'
  366. *
  367. * @see BxAlbumsModule::serviceBrowseFavoriteMedia
  368. */
  369. /**
  370. * @ref bx_albums-browse_favorite_media "browse_favorite_media"
  371. */
  372. public function serviceBrowseFavoriteMedia ($iProfileId = 0, $aParams = array())
  373. {
  374. $oProfile = null;
  375. if((int)$iProfileId)
  376. $oProfile = BxDolProfile::getInstance($iProfileId);
  377. if(!$oProfile && bx_get('profile_id') !== false)
  378. $oProfile = BxDolProfile:: getInstance(bx_process_input(bx_get('profile_id'), BX_DATA_INT));
  379. if(!$oProfile)
  380. $oProfile = BxDolProfile::getInstance();
  381. if(!$oProfile)
  382. return '';
  383. $bEmptyMessage = false;
  384. if(isset($aParams['empty_message'])) {
  385. $bEmptyMessage = (bool)$aParams['empty_message'];
  386. unset($aParams['empty_message']);
  387. }
  388. return $this->_serviceBrowse ('favorite', array_merge(array('user' => $oProfile->id()), $aParams), BX_DB_PADDING_DEF, $bEmptyMessage, true, 'SearchResultMedia');
  389. }
  390. public function serviceGetTimelineData()
  391. {
  392. $sModule = $this->_aModule['name'];
  393. $aResult = parent::serviceGetTimelineData();
  394. $aResult['handlers'] = array_merge($aResult['handlers'], array(
  395. array('group' => $sModule . '_object_media', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'medias_added', 'module_name' => $sModule, 'module_method' => 'get_timeline_media', 'module_class' => 'Module', 'groupable' => 0, 'group_by' => ''),
  396. ));
  397. $aResult['alerts'] = array_merge($aResult['alerts'], array(
  398. array('unit' => $sModule, 'action' => 'medias_added')
  399. ));
  400. return $aResult;
  401. }
  402. public function serviceGetTimelineMedia($aEvent, $aBrowseParams = array())
  403. {
  404. if(empty($aEvent['content']))
  405. return false;
  406. $aEvent['content'] = unserialize($aEvent['content']);
  407. if(empty($aEvent['content']['medias_added']) || !is_array($aEvent['content']['medias_added']))
  408. return false;
  409. $iContentId = (int)$aEvent['object_id'];
  410. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  411. if(empty($aContentInfo) || !is_array($aContentInfo))
  412. return false;
  413. $CNF = &$this->_oConfig->CNF;
  414. //--- Views
  415. $oViews = isset($CNF['OBJECT_VIEWS']) ? BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId) : null;
  416. $aViews = array();
  417. if ($oViews && $oViews->isEnabled())
  418. $aViews = array(
  419. 'system' => $CNF['OBJECT_VIEWS'],
  420. 'object_id' => $iContentId,
  421. 'count' => $aContentInfo['views']
  422. );
  423. //--- Votes
  424. $oVotes = isset($CNF['OBJECT_VOTES']) ? BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId) : null;
  425. $aVotes = array();
  426. if ($oVotes && $oVotes->isEnabled())
  427. $aVotes = array(
  428. 'system' => $CNF['OBJECT_VOTES'],
  429. 'object_id' => $iContentId,
  430. 'count' => $aContentInfo['votes']
  431. );
  432. //--- Scores
  433. $oScores = isset($CNF['OBJECT_SCORES']) ? BxDolScore::getObjectInstance($CNF['OBJECT_SCORES'], $iContentId) : null;
  434. $aScores = array();
  435. if ($oScores && $oScores->isEnabled())
  436. $aScores = array(
  437. 'system' => $CNF['OBJECT_SCORES'],
  438. 'object_id' => $iContentId,
  439. 'score' => $aContentInfo['score']
  440. );
  441. //--- Reports
  442. $oReports = isset($CNF['OBJECT_REPORTS']) ? BxDolReport::getObjectInstance($CNF['OBJECT_REPORTS'], $aEvent['object_id']) : null;
  443. $aReports = array();
  444. if ($oReports && $oReports->isEnabled())
  445. $aReports = array(
  446. 'system' => $CNF['OBJECT_REPORTS'],
  447. 'object_id' => $iContentId,
  448. 'count' => $aContentInfo['reports']
  449. );
  450. //--- Comments
  451. $oCmts = isset($CNF['OBJECT_COMMENTS']) ? BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId) : null;
  452. $aComments = array();
  453. if($oCmts && $oCmts->isEnabled())
  454. $aComments = array(
  455. 'system' => $CNF['OBJECT_COMMENTS'],
  456. 'object_id' => $iContentId,
  457. 'count' => $aContentInfo['comments']
  458. );
  459. //--- Title & Description
  460. $sTitle = isset($CNF['FIELD_TITLE']) && isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : (isset($CNF['FIELD_TEXT']) && isset($aContentInfo[$CNF['FIELD_TEXT']]) ? strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...') : '');
  461. return array(
  462. '_cache' => true,
  463. 'owner_id' => $aEvent['owner_id'],
  464. 'object_owner_id' => $aContentInfo['author'],
  465. 'icon' => !empty($CNF['ICON']) ? $CNF['ICON'] : '',
  466. 'sample' => isset($CNF['T']['txt_sample_single_with_article']) ? $CNF['T']['txt_sample_single_with_article'] : $CNF['T']['txt_sample_single'],
  467. 'sample_wo_article' => $CNF['T']['txt_sample_single'],
  468. 'sample_action' => $CNF['T']['txt_sample_action_changed'],
  469. 'url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId),
  470. 'content' => $this->_getContentForTimelineMedia($aEvent, $aContentInfo, $aBrowseParams), //a string to display or array to parse default template before displaying.
  471. 'date' => $aContentInfo[$CNF['FIELD_ADDED']],
  472. 'views' => $aViews,
  473. 'votes' => $aVotes,
  474. 'scores' => $aScores,
  475. 'reports' => $aReports,
  476. 'comments' => $aComments,
  477. 'title' => $sTitle, //may be empty.
  478. 'description' => '' //may be empty.
  479. );
  480. }
  481. public function serviceGetNotificationsData()
  482. {
  483. $sModule = $this->_aModule['name'];
  484. $sEventPrivacy = $sModule . '_allow_view_event_to';
  485. if(BxDolPrivacy::getObjectInstance($sEventPrivacy) === false)
  486. $sEventPrivacy = '';
  487. $aResult = parent::serviceGetNotificationsData();
  488. $aResult['handlers'] = array_merge($aResult['handlers'], array(
  489. array('group' => $sModule . '_object_media', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'medias_added', 'module_name' => $sModule, 'module_method' => 'get_notifications_media', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
  490. array('group' => $sModule . '_object_media', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'media_deleted'),
  491. array('group' => $sModule . '_comment_media', 'type' => 'insert', 'alert_unit' => $sModule . '_media', 'alert_action' => 'commentPost', 'module_name' => $sModule, 'module_method' => 'get_notifications_comment_media', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
  492. array('group' => $sModule . '_comment_media', 'type' => 'delete', 'alert_unit' => $sModule . '_media', 'alert_action' => 'commentRemoved'),
  493. array('group' => $sModule . '_vote_media', 'type' => 'insert', 'alert_unit' => $sModule . '_media', 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_vote_media', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
  494. array('group' => $sModule . '_vote_media', 'type' => 'delete', 'alert_unit' => $sModule . '_media', 'alert_action' => 'undoVote'),
  495. array('group' => $sModule . '_score_up_media', 'type' => 'insert', 'alert_unit' => $sModule . '_media', 'alert_action' => 'doVoteUp', 'module_name' => $sModule, 'module_method' => 'get_notifications_score_up_media', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
  496. array('group' => $sModule . '_score_down_media', 'type' => 'insert', 'alert_unit' => $sModule . '_media', 'alert_action' => 'doVoteDown', 'module_name' => $sModule, 'module_method' => 'get_notifications_score_down_media', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
  497. ));
  498. $aResult['settings'] = array_merge($aResult['settings'], array(
  499. array('group' => 'content', 'unit' => $sModule, 'action' => 'medias_added', 'types' => array('follow_member', 'follow_context')),
  500. array('group' => 'comment', 'unit' => $sModule . '_media', 'action' => 'commentPost', 'types' => array('personal', 'follow_member', 'follow_context')),
  501. array('group' => 'vote', 'unit' => $sModule . '_media', 'action' => 'doVote', 'types' => array('personal', 'follow_member', 'follow_context')),
  502. array('group' => 'score_up', 'unit' => $sModule . '_media', 'action' => 'doVoteUp', 'types' => array('personal', 'follow_member', 'follow_context')),
  503. array('group' => 'score_down', 'unit' => $sModule . '_media', 'action' => 'doVoteDown', 'types' => array('personal', 'follow_member', 'follow_context'))
  504. ));
  505. $aResult['alerts'] = array_merge($aResult['alerts'], array(
  506. array('unit' => $sModule, 'action' => 'medias_added'),
  507. array('unit' => $sModule, 'action' => 'media_deleted'),
  508. array('unit' => $sModule . '_media', 'action' => 'commentPost'),
  509. array('unit' => $sModule . '_media', 'action' => 'commentRemoved'),
  510. array('unit' => $sModule . '_media', 'action' => 'doVote'),
  511. array('unit' => $sModule . '_media', 'action' => 'undoVote'),
  512. array('unit' => $sModule . '_media', 'action' => 'doVoteUp'),
  513. array('unit' => $sModule . '_media', 'action' => 'doVoteDown'),
  514. ));
  515. return $aResult;
  516. }
  517. public function serviceGetNotificationsMedia($aEvent)
  518. {
  519. $CNF = &$this->_oConfig->CNF;
  520. $iContentId = (int)$aEvent['object_id'];
  521. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  522. if(empty($aContentInfo) || !is_array($aContentInfo))
  523. return array();
  524. $iMediaId = (int)$aEvent['subobject_id'];
  525. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  526. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  527. return array();
  528. $oPermalinks = BxDolPermalinks::getInstance();
  529. $sEntryUrl = BX_DOL_URL_ROOT . $oPermalinks->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId);
  530. $sSubentryUrl = BX_DOL_URL_ROOT . $oPermalinks->permalink('page.php?i=' . $CNF['URI_VIEW_MEDIA'] . '&id=' . $iMediaId);
  531. $sEntryCaption = isset($aMediaInfo['title']) ? $aMediaInfo['title'] : _t('_bx_albums_media');
  532. return array(
  533. 'entry_sample' => $CNF['T']['txt_sample_single'],
  534. 'entry_url' => $sEntryUrl,
  535. 'entry_caption' => $sEntryCaption,
  536. 'entry_author' => $aMediaInfo['author'],
  537. 'subentry_sample' => $CNF['T']['txt_media_single'],
  538. 'subentry_url' => $sSubentryUrl,
  539. 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
  540. );
  541. }
  542. public function serviceGetNotificationsCommentMedia($aEvent)
  543. {
  544. $CNF = &$this->_oConfig->CNF;
  545. $iMediaId = (int)$aEvent['object_id'];
  546. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  547. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  548. return array();
  549. $oComment = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS_MEDIA'], $iMediaId);
  550. if(!$oComment || !$oComment->isEnabled())
  551. return array();
  552. $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_MEDIA'] . '&id=' . $aMediaInfo['id']);
  553. $sEntryCaption = isset($aMediaInfo['title']) ? $aMediaInfo['title'] : _t('_bx_albums_media');
  554. return array(
  555. 'entry_sample' => $CNF['T']['txt_media_single'],
  556. 'entry_url' => $sEntryUrl,
  557. 'entry_caption' => $sEntryCaption,
  558. 'entry_author' => $aMediaInfo['author'],
  559. 'subentry_sample' => $CNF['T']['txt_media_comment_single'],
  560. 'subentry_url' => $oComment->getViewUrl((int)$aEvent['subobject_id']),
  561. 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
  562. );
  563. }
  564. public function serviceGetNotificationsVoteMedia($aEvent)
  565. {
  566. $CNF = &$this->_oConfig->CNF;
  567. $iMediaId = (int)$aEvent['object_id'];
  568. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  569. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  570. return array();
  571. $oVote = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_MEDIA'], $iMediaId);
  572. if(!$oVote || !$oVote->isEnabled())
  573. return array();
  574. $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_MEDIA'] . '&id=' . $aMediaInfo['id']);
  575. $sEntryCaption = isset($aMediaInfo['title']) ? $aMediaInfo['title'] : _t('_bx_albums_media');
  576. return array(
  577. 'entry_sample' => $CNF['T']['txt_media_single'],
  578. 'entry_url' => $sEntryUrl,
  579. 'entry_caption' => $sEntryCaption,
  580. 'entry_author' => $aMediaInfo['author'],
  581. 'subentry_sample' => $CNF['T']['txt_media_vote_single'],
  582. 'subentry_url' => '',
  583. 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
  584. );
  585. }
  586. public function serviceGetNotificationsScoreUpMedia($aEvent)
  587. {
  588. return $this->_serviceGetNotificationsScoreMedia('up', $aEvent);
  589. }
  590. public function serviceGetNotificationsScoreDownMedia($aEvent)
  591. {
  592. return $this->_serviceGetNotificationsScoreMedia('down', $aEvent);
  593. }
  594. protected function _serviceGetNotificationsScoreMedia($sType, $aEvent)
  595. {
  596. $CNF = &$this->_oConfig->CNF;
  597. $iMediaId = (int)$aEvent['object_id'];
  598. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  599. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  600. return array();
  601. $oVote = BxDolScore::getObjectInstance($CNF['OBJECT_SCORES_MEDIA'], $iMediaId);
  602. if(!$oVote || !$oVote->isEnabled())
  603. return array();
  604. $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_MEDIA'] . '&id=' . $aMediaInfo['id']);
  605. $sEntryCaption = isset($aMediaInfo['title']) ? $aMediaInfo['title'] : _t('_bx_albums_media');
  606. return array(
  607. 'entry_sample' => $CNF['T']['txt_media_single'],
  608. 'entry_url' => $sEntryUrl,
  609. 'entry_caption' => $sEntryCaption,
  610. 'entry_author' => $aMediaInfo['author'],
  611. 'subentry_sample' => $CNF['T']['txt_media_score_' . $sType . '_single'],
  612. 'subentry_url' => '',
  613. 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
  614. );
  615. }
  616. public function actionEditMedia($iMediaId)
  617. {
  618. $CNF = &$this->_oConfig->CNF;
  619. $iMediaId = (int)$iMediaId;
  620. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  621. $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_MEDIA'], $CNF['OBJECT_FORM_MEDIA_DISPLAY_EDIT']);
  622. $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'edit_media/' . $iMediaId;
  623. $oForm->initChecker($aMediaInfo);
  624. if($oForm->isSubmittedAndValid()) {
  625. if($oForm->update($iMediaId) !== false)
  626. $aRes = array('reload' => 1);
  627. else
  628. $aRes = array('msg' => _t('_bx_albums_txt_err_cannot_perform_action'));
  629. return echoJson($aRes);
  630. }
  631. $sContent = BxTemplStudioFunctions::getInstance()->transBox('bx-albums-edit-media-popup', $this->_oTemplate->parseHtmlByName('media-edit.html', array(
  632. 'form_id' => $oForm->aFormAttrs['id'],
  633. 'form' => $oForm->getCode(true)
  634. )));
  635. echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))));
  636. }
  637. public function actionGetSiblingMedia($iMediaId, $mixedContext)
  638. {
  639. $aSiblings = false;
  640. $sErrorMsg = false;
  641. if (!($aMediaInfo = $this->_oDb->getMediaInfoById((int)$iMediaId)))
  642. $sErrorMsg = _t('_sys_txt_error_occured');
  643. if (empty($sErrorMsg) && !($aContentInfo = $this->_oDb->getContentInfoById($aMediaInfo['content_id'])))
  644. $sErrorMsg = _t('_sys_txt_error_occured');
  645. if (empty($sErrorMsg) && (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->checkAllowedView($aContentInfo))))
  646. $sErrorMsg = $sMsg;
  647. if (empty($sErrorMsg)) {
  648. $aSiblings = array (
  649. 'next' => $this->_oTemplate->getNextPrevMedia($aMediaInfo, true, $mixedContext),
  650. 'prev' => $this->_oTemplate->getNextPrevMedia($aMediaInfo, false, $mixedContext),
  651. );
  652. }
  653. $a = $sErrorMsg ? array('error' => $sErrorMsg) : array('next' => $aSiblings['next'], 'prev' => $aSiblings['prev']);
  654. $s = json_encode($a);
  655. header('Content-type: text/html; charset=utf-8');
  656. echo $s;
  657. }
  658. public function actionRssMedia ()
  659. {
  660. $aArgs = func_get_args();
  661. $this->_rss($aArgs, 'SearchResultMedia');
  662. }
  663. public function getMediaDuration($aMediaInfo)
  664. {
  665. $CNF = &$this->_oConfig->CNF;
  666. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  667. return 0;
  668. $sField = 'duration';
  669. if(!empty($aMediaInfo[$sField]))
  670. return (int)$aMediaInfo[$sField];
  671. $iMedia = $aMediaInfo['id'];
  672. $sMedia = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4'])->getFileUrl($iMedia);
  673. if(empty($sMedia))
  674. return 0;
  675. $iDuration = (int)BxDolTranscoderVideo::getDuration($sMedia);
  676. if(!empty($iDuration))
  677. $this->_oDb->updateMedia(array($sField => $iDuration), array('id' => $iMedia));
  678. return $iDuration;
  679. }
  680. protected function _buildRssParams($sMode, $aArgs)
  681. {
  682. if ($aParams = parent::_buildRssParams($sMode, $aArgs))
  683. return $aParams;
  684. $sMode = bx_process_input($sMode);
  685. switch ($sMode) {
  686. case 'album':
  687. $aParams = array('album_id' => isset($aArgs[0]) ? (int)$aArgs[0] : '');
  688. break;
  689. }
  690. return $aParams;
  691. }
  692. protected function _getImagesForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  693. {
  694. $CNF = &$this->_oConfig->CNF;
  695. if(empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']) || empty($CNF['OBJECT_TRANSCODER_COVER']))
  696. return array();
  697. $aMediaList = $this->_oDb->getMediaListByContentId($aContentInfo[$CNF['FIELD_ID']]);
  698. if(empty($aMediaList) || !is_array($aMediaList))
  699. return array();
  700. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
  701. $oTcPoster = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']);
  702. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
  703. $oTranscoderCover = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_TRANSCODER_COVER']);
  704. if(!$oTranscoder || !$oTranscoderCover)
  705. return array();
  706. $aOutput = array();
  707. foreach ($aMediaList as $aMedia) {
  708. $aFileInfo = $oStorage->getFile($aMedia['file_id']);
  709. $bVideo = $oTcPoster && strncmp('video/', $aFileInfo['mime_type'], 6) === 0 && $oTcPoster->isMimeTypeSupported($aFileInfo['mime_type']);
  710. if($bVideo)
  711. continue;
  712. $aOutput[$aMedia['id']] = array (
  713. 'id' => $aMedia['id'],
  714. 'url' => $this->_oTemplate->getViewMediaUrl($CNF, $aMedia['id']),
  715. 'src' => $oTranscoder->getFileUrl($aMedia['file_id']),
  716. 'src_orig' => $oTranscoderCover->getFileUrl($aMedia['file_id'])
  717. );
  718. }
  719. if(empty($aOutput))
  720. return array();
  721. $iSlice = 4;
  722. $iTotal = count($aOutput);
  723. return array(
  724. 'total' => $iTotal,
  725. 'items' => $iTotal > $iSlice ? array_slice($aOutput, 0, $iSlice) : $aOutput
  726. );
  727. }
  728. protected function _getVideosForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  729. {
  730. $CNF = &$this->_oConfig->CNF;
  731. if(empty($CNF['OBJECT_VIDEOS_TRANSCODERS']))
  732. return array();
  733. $aMediaList = $this->_oDb->getMediaListByContentId($aContentInfo[$CNF['FIELD_ID']]);
  734. if(empty($aMediaList) || !is_array($aMediaList))
  735. return array();
  736. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
  737. $oTcPoster = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']);
  738. $oTcMp4 = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']);
  739. $oTcMp4Hd = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4_hd']);
  740. if(!$oTcPoster || !$oTcMp4 || !$oTcMp4Hd)
  741. return array();
  742. $aOutput = array();
  743. foreach($aMediaList as $k => $aMedia) {
  744. $aFileInfo = $oStorage->getFile($aMedia['file_id']);
  745. $bVideo = $oTcPoster && strncmp('video/', $aFileInfo['mime_type'], 6) === 0 && $oTcPoster->isMimeTypeSupported($aFileInfo['mime_type']);
  746. if(!$bVideo)
  747. continue;
  748. $sVideoUrl = $oStorage->getFileUrlById($aMedia['file_id']);
  749. $aVideoSize = $oTcMp4Hd->getVideoSize($sVideoUrl);
  750. $sVideoUrlHd = '';
  751. if(!empty($aVideoSize) && is_array($aVideoSize) && (int)$aVideoSize['h'] >= 720)
  752. $sVideoUrlHd = $oTcMp4Hd->getFileUrl($aMedia['file_id']);
  753. $aOutput[$aMedia['id']] = array(
  754. 'id' => $aMedia['id'],
  755. 'src_poster' => $oTcPoster->getFileUrl($aMedia['file_id']),
  756. 'src_mp4' => $oTcMp4->getFileUrl($aMedia['file_id']),
  757. 'src_mp4_hd' => $sVideoUrlHd,
  758. 'duration' => $aFileInfo['duration'],
  759. );
  760. }
  761. if(empty($aOutput))
  762. return array();
  763. $iSlice = 4;
  764. $iTotal = count($aOutput);
  765. return array(
  766. 'total' => $iTotal,
  767. 'items' => $iTotal > $iSlice ? array_slice($aOutput, 0, $iSlice) : $aOutput
  768. );
  769. }
  770. protected function _getContentForTimelineMedia($aEvent, $aContentInfo, $aBrowseParams = array())
  771. {
  772. $CNF = &$this->_oConfig->CNF;
  773. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
  774. $sTitle = isset($CNF['FIELD_TITLE']) && isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : (isset($CNF['FIELD_TEXT']) && isset($aContentInfo[$CNF['FIELD_TEXT']]) ? strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...') : '');
  775. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
  776. $oTcPoster = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']);
  777. $oTcMp4 = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']);
  778. $oTcMp4Hd = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4_hd']);
  779. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
  780. $oTranscoderCover = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_TRANSCODER_COVER']);
  781. //--- Image(s) and Video(s)
  782. $aImages = $aVideos = array();
  783. foreach($aEvent['content']['medias_added'] as $iMediaId) {
  784. $aMediaInfo = $this->_oDb->getMediaInfoById($iMediaId);
  785. if(empty($aMediaInfo) || !is_array($aMediaInfo))
  786. continue;
  787. $aFileInfo = $oStorage->getFile($aMediaInfo['file_id']);
  788. $bVideo = $oTcPoster && strncmp('video/', $aFileInfo['mime_type'], 6) === 0 && $oTcPoster->isMimeTypeSupported($aFileInfo['mime_type']);
  789. if($bVideo)
  790. $aVideos[$iMediaId] = array(
  791. 'id' => $aMediaInfo['id'],
  792. 'src_poster' => $oTcPoster->getFileUrl($aMediaInfo['file_id']),
  793. 'src_mp4' => $oTcMp4->getFileUrl($aMediaInfo['file_id']),
  794. 'src_mp4_hd' => $oTcMp4Hd->getFileUrl($aMediaInfo['file_id']),
  795. 'duration' => $aFileInfo['duration'],
  796. );
  797. else
  798. $aImages[$iMediaId] = array(
  799. 'id' => $aMediaInfo['id'],
  800. 'url' => $this->_oTemplate->getViewMediaUrl($CNF, $aMediaInfo['id']),
  801. 'src' => $oTranscoder->getFileUrl($aMediaInfo['file_id']),
  802. 'src_orig' => $oTranscoderCover->getFileUrl($aMediaInfo['file_id'])
  803. );
  804. }
  805. return array(
  806. 'sample' => isset($CNF['T']['txt_sample_single_with_article']) ? $CNF['T']['txt_sample_single_with_article'] : $CNF['T']['txt_sample_single'],
  807. 'sample_wo_article' => $CNF['T']['txt_sample_single'],
  808. 'sample_action' => isset($CNF['T']['txt_sample_action_changed']),
  809. 'url' => $sUrl,
  810. 'title' => $sTitle,
  811. 'text' => '',
  812. 'images_attach' => $aImages,
  813. 'videos_attach' => $aVideos
  814. );
  815. }
  816. protected function _getImagesForTimelineMedia($aEvent, $aMediaInfo, $sUrl, $aBrowseParams = array())
  817. {
  818. $CNF = &$this->_oConfig->CNF;
  819. $aImages = array();
  820. return $aImages;
  821. }
  822. }
  823. /** @} */