BxBaseModTextModule.php 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  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 BaseText Base classes for text modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. define('BX_BASE_MOD_TEXT_STATUS_ACTIVE', 'active');
  12. define('BX_BASE_MOD_TEXT_STATUS_HIDDEN', 'hidden');
  13. define('BX_BASE_MOD_TEXT_STATUS_AWAITING', 'awaiting');
  14. /**
  15. * Saved for backward compatibility.
  16. * Can be removed in future releases of UNA 13.
  17. */
  18. define('BX_BASE_MOD_TEXT_STATUS_PENDING', 'pending');
  19. /**
  20. * Base module class for text based modules
  21. */
  22. class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolContentInfoService
  23. {
  24. function __construct(&$aModule)
  25. {
  26. parent::__construct($aModule);
  27. }
  28. // ====== ACTIONS METHODS
  29. public function actionEmbedPoll($iPollId = 0)
  30. {
  31. if(empty($iPollId) && bx_get('poll_id') !== false)
  32. $iPollId = (int)bx_get('poll_id');
  33. $aParams = bx_get_with_prefix('param');
  34. array_walk($aParams, function(&$sValue) {
  35. $sValue = bx_process_input($sValue);
  36. });
  37. $this->_oTemplate->embedPollItem($iPollId, $aParams);
  38. }
  39. public function actionEmbedPolls($iId = 0)
  40. {
  41. list($iContentId, $aContentInfo) = $this->_getContent($iId);
  42. if($iContentId === false)
  43. return;
  44. $aParams = bx_get_with_prefix('param');
  45. array_walk($aParams, function(&$sValue) {
  46. $sValue = bx_process_input($sValue);
  47. });
  48. $this->_oTemplate->embedPollItems($aContentInfo, $aParams);
  49. }
  50. public function actionGetPoll()
  51. {
  52. $iPollId = (int)bx_get('poll_id');
  53. $sView = bx_process_input(bx_get('view'));
  54. $sMethod = 'serviceGetBlockPoll' . bx_gen_method_name($sView);
  55. if(!method_exists($this, $sMethod))
  56. return echoJson(array());
  57. $aBlock = $this->$sMethod($iPollId, true);
  58. if(empty($aBlock) || !is_array($aBlock))
  59. return echoJson(array());
  60. return echoJson(array(
  61. 'content' => $aBlock['content']
  62. ));
  63. }
  64. public function actionDeletePoll()
  65. {
  66. $CNF = &$this->_oConfig->CNF;
  67. $iId = bx_process_input(bx_get('id'), BX_DATA_INT);
  68. if(empty($iId))
  69. return echoJson(array());
  70. $aResult = array();
  71. if($this->_oDb->deletePolls(array($CNF['FIELD_POLL_ID'] => $iId)))
  72. $aResult = array('code' => 0);
  73. else
  74. $aResult = array('code' => 1, 'message' => _t($CNF['txt_err_cannot_perform_action']));
  75. echoJson($aResult);
  76. }
  77. public function actionGetPollForm()
  78. {
  79. echo $this->_oTemplate->getPollForm();
  80. }
  81. public function actionSubmitPollForm()
  82. {
  83. echoJson($this->getPollForm());
  84. }
  85. public function actionFileEmbedVideo($iFileId)
  86. {
  87. $this->_oTemplate->embedVideo($iFileId);
  88. }
  89. public function actionFileEmbedSound($iFileId)
  90. {
  91. $this->_oTemplate->embedSound($iFileId);
  92. }
  93. // ====== SERVICE METHODS
  94. public function serviceGetSafeServices()
  95. {
  96. $a = parent::serviceGetSafeServices();
  97. return array_merge($a, array (
  98. 'GetBlockPollAnswers' => '',
  99. 'GetBlockPollResults' => '',
  100. 'GetMenuAddonManageToolsProfileStats' => '',
  101. 'BrowsePublic' => '',
  102. 'BrowsePopular' => '',
  103. 'BrowseTop' => '',
  104. 'BrowseUpdated' => '',
  105. 'BrowseAuthor' => '',
  106. 'CategoriesMultiListContext' => ''
  107. ));
  108. }
  109. public function serviceManageTools($sType = 'common')
  110. {
  111. $this->_oTemplate->addJs(['modules/base/text/js/|manage_tools.js']);
  112. return parent::serviceManageTools($sType);
  113. }
  114. /**
  115. * @page service Service Calls
  116. * @section bx_base_text Base Text
  117. * @subsection bx_base_general-page_blocks Page Blocks
  118. * @subsubsection bx_base_general-categories_multi_list_context categories_multi_list_context
  119. *
  120. * @code bx_srv('bx_posts', 'categories_multi_list_context', [...]); @endcode
  121. *
  122. * Display multi-categorories block with number of posts in each category for current context
  123. * @param $bDisplayEmptyCats display empty categories
  124. *
  125. * @see BxBaseModGeneralModule::serviceCategoriesMultiListContext
  126. */
  127. /**
  128. * @ref bx_base_general-categories_multi_list_context "categories_multi_list_context"
  129. */
  130. public function serviceCategoriesMultiListContext($iProfileId = 0, $bDisplayEmptyCats = true)
  131. {
  132. if ($iProfileId == 0)
  133. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  134. $oCategories = BxDolCategories::getInstance();
  135. $aCats = $oCategories->getData([
  136. 'type' => 'by_module&context_with_num',
  137. 'module' => $this->getName(),
  138. 'context_id' => $iProfileId
  139. ]
  140. );
  141. $aVars = array('bx_repeat:cats' => array());
  142. foreach ($aCats as $oCat) {
  143. $sValue = $oCat['value'];
  144. $iNum = $oCat['num'];
  145. $aVars['bx_repeat:cats'][] = array(
  146. 'url' => $oCategories->getUrl($this->getName(), $sValue, '&context_id=' . $iProfileId),
  147. 'name' => _t($sValue),
  148. 'value' => $sValue,
  149. 'num' => $iNum,
  150. );
  151. }
  152. if (!$aVars['bx_repeat:cats'])
  153. return '';
  154. return $this->_oTemplate->parseHtmlByName('category_list_multi.html', $aVars);
  155. }
  156. /**
  157. * @page service Service Calls
  158. * @section bx_base_text Base Text
  159. * @subsection bx_base_text-polls Polls Blocks
  160. * @subsubsection bx_base_text-get_block_poll_answers get_block_poll_answers
  161. *
  162. * @code bx_srv('bx_posts', 'get_block_poll_answers', [...]); @endcode
  163. *
  164. * Get block with poll answers
  165. * @param $iPollId poll ID
  166. *
  167. * @see BxBaseModTextModule::serviceGetBlockPollAnswers
  168. */
  169. /**
  170. * @ref bx_base_text-get_block_poll_answers "get_block_poll_answers"
  171. */
  172. public function serviceGetBlockPollAnswers($iPollId, $bForceDisplay = false)
  173. {
  174. if(!$iPollId)
  175. return false;
  176. if(!$bForceDisplay && $this->isPollPerformed($iPollId))
  177. return $this->serviceGetBlockPollResults($iPollId);
  178. return $this->_serviceTemplateFunc('entryPollAnswers', $iPollId, 'getPollInfoById');
  179. }
  180. /**
  181. * @page service Service Calls
  182. * @section bx_base_text Base Text
  183. * @subsection bx_base_text-polls Polls Blocks
  184. * @subsubsection bx_base_text-get_block_poll_results get_block_poll_results
  185. *
  186. * @code bx_srv('bx_posts', 'get_block_poll_results', [...]); @endcode
  187. *
  188. * Get block with poll results
  189. * @param $iPollId poll ID
  190. *
  191. * @see BxBaseModTextModule::serviceGetBlockPollResults
  192. */
  193. /**
  194. * @ref bx_base_text-get_block_poll_results "get_block_poll_results"
  195. */
  196. public function serviceGetBlockPollResults($iPollId)
  197. {
  198. return $this->_serviceTemplateFunc('entryPollResults', $iPollId, 'getPollInfoById');
  199. }
  200. /**
  201. * Display media EXIF information.
  202. * @param $iMediaId media ID, if it's omitted then it's taken from 'id' GET variable.
  203. * @return HTML string with EXIF info. On error empty string is returned.
  204. */
  205. public function serviceMediaExif ($iMediaId = 0)
  206. {
  207. $CNF = &$this->_oConfig->CNF;
  208. return $this->_serviceTemplateFunc ('mediaExif', $iMediaId, $CNF['FUNCTION_FOR_GET_ITEM_INFO']);
  209. }
  210. public function serviceGetThumb ($iContentId, $sTranscoder = '')
  211. {
  212. $CNF = &$this->_oConfig->CNF;
  213. if(bx_is_api()){
  214. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  215. if (isset($CNF['FIELD_THUMB']))
  216. return bx_api_get_image($CNF['OBJECT_STORAGE'], $aContentInfo[$CNF['FIELD_THUMB']]);
  217. }
  218. if(empty($sTranscoder) && !empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']))
  219. $sTranscoder = $CNF['OBJECT_IMAGES_TRANSCODER_GALLERY'];
  220. $mixedResult = $this->_getFieldValueThumb('FIELD_THUMB', $iContentId, $sTranscoder);
  221. return $mixedResult !== false ? $mixedResult : '';
  222. }
  223. public function serviceGetMenuAddonManageTools()
  224. {
  225. $CNF = &$this->_oConfig->CNF;
  226. $iNumTotal = $this->_oDb->getEntriesNumByParams();
  227. $iNum1 = $this->_oDb->getEntriesNumByParams([
  228. [
  229. 'key' => $CNF['FIELD_STATUS'],
  230. 'value' => 'hidden',
  231. 'operator' => '='
  232. ]
  233. ]);
  234. $iNum2 = 0;
  235. if (isset($CNF['OBJECT_REPORTS'])){
  236. $iNum2 = $this->_oDb->getEntriesNumByParams([
  237. [
  238. 'key' => 'reports',
  239. 'value' => '0',
  240. 'operator' => '>'
  241. ]
  242. ]);
  243. }
  244. return array('counter1_value' => $iNum1, 'counter2_value' => $iNum2, 'counter3_value' => $iNumTotal );
  245. }
  246. /**
  247. * @page service Service Calls
  248. * @section bx_base_text Base Text
  249. * @subsection bx_base_text-other Other
  250. * @subsubsection bx_base_text-get_menu_addon_manage_tools_profile_stats get_menu_addon_manage_tools_profile_stats
  251. *
  252. * @code bx_srv('bx_posts', 'get_menu_addon_manage_tools_profile_stats', []); @endcode
  253. *
  254. * Get number of posts for currently logged in user
  255. *
  256. * @see BxBaseModTextModule::serviceGetMenuAddonManageToolsProfileStats
  257. */
  258. /**
  259. * @ref bx_base_text-get_menu_addon_manage_tools_profile_stats "get_menu_addon_manage_tools_profile_stats"
  260. */
  261. public function serviceGetMenuAddonManageToolsProfileStats($iProfileId = 0)
  262. {
  263. if(!$iProfileId)
  264. $iProfileId = bx_get_logged_profile_id();
  265. bx_import('SearchResult', $this->_aModule);
  266. $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
  267. $o = new $sClass();
  268. $o->fillFilters([
  269. 'author' => $iProfileId
  270. ]);
  271. $o->unsetPaginate();
  272. return $o->getNum();
  273. }
  274. /**
  275. * @page service Service Calls
  276. * @section bx_base_text Base Text
  277. * @subsection bx_base_text-browse Browse
  278. * @subsubsection bx_base_text-browse_public browse_public
  279. *
  280. * @code bx_srv('bx_posts', 'browse_public', [...]); @endcode
  281. *
  282. * Display public posts
  283. * @param $sUnitView unit view, such as: full, extended, gallery, showcase
  284. * @param $bEmptyMessage display or not "empty" message when there is no content
  285. * @param $bAjaxPaginate use AJAX paginate or not
  286. *
  287. * @see BxBaseModTextModule::serviceBrowsePublic
  288. */
  289. /**
  290. * @ref bx_base_text-browse_public "browse_public"
  291. */
  292. public function serviceBrowsePublic ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  293. {
  294. return $this->_serviceBrowse ('public', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  295. }
  296. /**
  297. * @page service Service Calls
  298. * @section bx_base_text Base Text
  299. * @subsection bx_base_text-browse Browse
  300. * @subsubsection bx_base_text-browse_popular browse_popular
  301. *
  302. * @code bx_srv('bx_posts', 'browse_popular', [...]); @endcode
  303. *
  304. * Display popular posts
  305. * @param $sUnitView unit view, such as: full, extended, gallery, showcase
  306. * @param $bEmptyMessage display or not "empty" message when there is no content
  307. * @param $bAjaxPaginate use AJAX paginate or not
  308. *
  309. * @see BxBaseModTextModule::serviceBrowsePopular
  310. */
  311. /**
  312. * @ref bx_base_text-browse_popular "browse_popular"
  313. */
  314. public function serviceBrowsePopular ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  315. {
  316. return $this->_serviceBrowse ('popular', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  317. }
  318. /**
  319. * @page service Service Calls
  320. * @section bx_base_text Base Text
  321. * @subsection bx_base_text-browse Browse
  322. * @subsubsection bx_base_text-browse_top browse_top
  323. *
  324. * @code bx_srv('bx_posts', 'browse_top', [...]); @endcode
  325. *
  326. * Display top posts
  327. * @param $sUnitView unit view, such as: full, extended, gallery, showcase
  328. * @param $bEmptyMessage display or not "empty" message when there is no content
  329. * @param $bAjaxPaginate use AJAX paginate or not
  330. *
  331. * @see BxBaseModTextModule::serviceBrowseTop
  332. */
  333. /**
  334. * @ref bx_base_text-browse_top "browse_top"
  335. */
  336. public function serviceBrowseTop ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  337. {
  338. return $this->_serviceBrowse ('top', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  339. }
  340. /**
  341. * @page service Service Calls
  342. * @section bx_base_text Base Text
  343. * @subsection bx_base_text-browse Browse
  344. * @subsubsection bx_base_text-browse_updated browse_updated
  345. *
  346. * @code bx_srv('bx_posts', 'browse_updated', [...]); @endcode
  347. *
  348. * Display recently updated posts
  349. * @param $sUnitView unit view, such as: full, extended, gallery, showcase
  350. * @param $bEmptyMessage display or not "empty" message when there is no content
  351. * @param $bAjaxPaginate use AJAX paginate or not
  352. *
  353. * @see BxBaseModTextModule::serviceBrowseUpdated
  354. */
  355. /**
  356. * @ref bx_base_text-browse_updated "browse_updated"
  357. */
  358. public function serviceBrowseUpdated ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  359. {
  360. return $this->_serviceBrowse ('updated', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  361. }
  362. /**
  363. * @page service Service Calls
  364. * @section bx_base_text Base Text
  365. * @subsection bx_base_text-browse Browse
  366. * @subsubsection bx_base_text-browse_author browse_author
  367. *
  368. * @code bx_srv('bx_posts', 'browse_author', [...]); @endcode
  369. *
  370. * Display posts of specified author
  371. * @param $iProfileId profile ID
  372. * @param $aParams additional params, see BxBaseModGeneralModule::serviceBrowse
  373. *
  374. * @see BxBaseModTextModule::serviceBrowseAuthor
  375. */
  376. /**
  377. * @ref bx_base_text-browse_author "browse_author"
  378. */
  379. public function serviceBrowseAuthor ($iProfileId = 0, $aParams = array())
  380. {
  381. return $this->_serviceBrowseWithParam ('author', 'profile_id', $iProfileId, $aParams);
  382. }
  383. /**
  384. * @page service Service Calls
  385. * @section bx_base_text Base Text
  386. * @subsection bx_base_text-page_blocks Page Blocks
  387. * @subsubsection bx_base_text-entity_author entity_author
  388. *
  389. * @code bx_srv('bx_posts', 'entity_author', [...]); @endcode
  390. *
  391. * Display author block for the specified post
  392. * @param $iContentId content ID
  393. *
  394. * @see BxBaseModTextModule::serviceEntityAuthor
  395. */
  396. /**
  397. * @ref bx_base_text-entity_author "entity_author"
  398. */
  399. public function serviceEntityAuthor ($iContentId = 0)
  400. {
  401. return $this->_serviceTemplateFunc ('entryAuthor', $iContentId);
  402. }
  403. /**
  404. * @page service Service Calls
  405. * @section bx_base_text Base Text
  406. * @subsection bx_base_text-page_blocks Page Blocks
  407. * @subsubsection bx_base_text-entity_polls entity_polls
  408. *
  409. * @code bx_srv('bx_posts', 'entity_polls', [...]); @endcode
  410. *
  411. * Display polls for the specified post
  412. * @param $iContentId content ID
  413. *
  414. * @see BxBaseModTextModule::serviceEntityPolls
  415. */
  416. /**
  417. * @ref bx_base_text-entity_polls "entity_polls"
  418. */
  419. public function serviceEntityPolls ($iContentId = 0)
  420. {
  421. return $this->_serviceTemplateFunc ('entryPolls', $iContentId);
  422. }
  423. /**
  424. * @page service Service Calls
  425. * @section bx_base_text Base Text
  426. * @subsection bx_base_text-page_blocks Page Blocks
  427. * @subsubsection bx_base_text-entity_breadcrumb entity_breadcrumb
  428. *
  429. * @code bx_srv('bx_forum', 'entity_breadcrumb', [...]); @endcode
  430. *
  431. * Display breadcrumb for the specified post
  432. * @param $iContentId content ID
  433. *
  434. * @see BxBaseModTextModule::serviceEntityBreadcrumb
  435. */
  436. /**
  437. * @ref bx_base_text-entity_breadcrumb "entity_breadcrumb"
  438. */
  439. public function serviceEntityBreadcrumb ($iContentId = 0)
  440. {
  441. return $this->_serviceTemplateFunc ('entryBreadcrumb', $iContentId);
  442. }
  443. /**
  444. * Delete all content by profile
  445. * @param $iProfileId profile id
  446. * @return number of deleted items
  447. */
  448. public function serviceDeleteEntitiesByAuthor ($iProfileId)
  449. {
  450. $a = $this->_oDb->getEntriesByAuthor((int)$iProfileId);
  451. if (!$a)
  452. return 0;
  453. $iCount = 0;
  454. foreach ($a as $aContentInfo)
  455. $iCount += ('' == $this->serviceDeleteEntity($aContentInfo[$this->_oConfig->CNF['FIELD_ID']]) ? 1 : 0);
  456. return $iCount;
  457. }
  458. // ====== PERMISSION METHODS
  459. /**
  460. * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
  461. */
  462. public function checkAllowedSetThumb ($iContentId = 0)
  463. {
  464. // check ACL
  465. $aCheck = checkActionModule($this->_iProfileId, 'set thumb', $this->getName(), false);
  466. if ($aCheck[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED)
  467. return $aCheck[CHECK_ACTION_MESSAGE];
  468. return CHECK_ACTION_RESULT_ALLOWED;
  469. }
  470. public function isAllowedApprove($mixedContent, $isPerformAction = false)
  471. {
  472. return $this->checkAllowedApprove($mixedContent, $isPerformAction) === CHECK_ACTION_RESULT_ALLOWED;
  473. }
  474. public function checkAllowedApprove($mixedContent, $isPerformAction = false)
  475. {
  476. $CNF = &$this->_oConfig->CNF;
  477. $sTxtError = '_sys_txt_access_denied';
  478. $iProfileId = bx_get_logged_profile_id();
  479. if(!is_array($mixedContent))
  480. $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
  481. if(empty($mixedContent) || !is_array($mixedContent))
  482. return _t($sTxtError);
  483. if(!isset($CNF['FIELD_STATUS_ADMIN']) || $mixedContent[$CNF['FIELD_STATUS_ADMIN']] != BX_BASE_MOD_GENERAL_STATUS_PENDING)
  484. return _t($sTxtError);
  485. if($this->_isModerator())
  486. return CHECK_ACTION_RESULT_ALLOWED;
  487. if(!empty($CNF['FIELD_ALLOW_VIEW_TO']) && (int)$mixedContent[$CNF['FIELD_ALLOW_VIEW_TO']] < 0) {
  488. $iContextProfileId = abs((int)$mixedContent[$CNF['FIELD_ALLOW_VIEW_TO']]);
  489. $oContextProfile = BxDolProfile::getInstance($iContextProfileId);
  490. $aAdmins = bx_srv($oContextProfile->getModule(), 'get_admins_to_manage_content', [$iContextProfileId]);
  491. if(!empty($aAdmins) && in_array($iProfileId, $aAdmins))
  492. return CHECK_ACTION_RESULT_ALLOWED;
  493. }
  494. return _t($sTxtError);
  495. }
  496. public function isPollPerformed($iObjectId, $iAuthorId = 0, $iAuthorIp = 0)
  497. {
  498. if(empty($iAuthorId)) {
  499. $iAuthorId = bx_get_logged_profile_id();
  500. $iAuthorIp = bx_get_ip_hash(getVisitorIP());
  501. }
  502. return $this->_oDb->isPollPerformed($iObjectId, $iAuthorId, $iAuthorIp);
  503. }
  504. // ====== COMMON METHODS
  505. public function deleteAttachLinks($iId)
  506. {
  507. if(!$this->_oConfig->isAttachLinks())
  508. return;
  509. $CNF = &$this->_oConfig->CNF;
  510. $aLinks = $this->_oDb->getLinks($iId);
  511. if(empty($aLinks) || !is_array($aLinks))
  512. return;
  513. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE_PHOTOS']);
  514. foreach($aLinks as $aLink)
  515. if(!empty($aLink['media_id']))
  516. $oStorage->deleteFile($aLink['media_id']);
  517. $this->_oDb->deleteLinks($iId);
  518. }
  519. public function deleteAttachLinksUnused($iProfileId)
  520. {
  521. if(!$this->_oConfig->isAttachLinks())
  522. return;
  523. $CNF = &$this->_oConfig->CNF;
  524. $aLinks = $this->_oDb->getUnusedLinks($iProfileId);
  525. if(empty($aLinks) || !is_array($aLinks))
  526. return;
  527. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE_PHOTOS']);
  528. foreach($aLinks as $aLink)
  529. if(!empty($aLink['media_id']))
  530. $oStorage->deleteFile($aLink['media_id']);
  531. $this->_oDb->deleteUnusedLinks($iProfileId);
  532. }
  533. public function onApprove($mixedContent)
  534. {
  535. $CNF = &$this->_oConfig->CNF;
  536. if(!is_array($mixedContent))
  537. $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
  538. $this->alertAfterApprove($mixedContent);
  539. $this->onPublished($mixedContent[$CNF['FIELD_ID']]);
  540. }
  541. public function alertAfterAdd($aContentInfo)
  542. {
  543. $CNF = &$this->_oConfig->CNF;
  544. $iId = (int)$aContentInfo[$CNF['FIELD_ID']];
  545. $iAuthorId = (int)$aContentInfo[$CNF['FIELD_AUTHOR']];
  546. $sAction = 'added';
  547. if(isset($CNF['FIELD_STATUS']) && isset($aContentInfo[$CNF['FIELD_STATUS']]) && $aContentInfo[$CNF['FIELD_STATUS']] == BX_BASE_MOD_TEXT_STATUS_AWAITING)
  548. $sAction = 'deferred';
  549. else if(isset($CNF['FIELD_STATUS_ADMIN']) && isset($aContentInfo[$CNF['FIELD_STATUS_ADMIN']]) && $aContentInfo[$CNF['FIELD_STATUS_ADMIN']] == BX_BASE_MOD_GENERAL_STATUS_PENDING)
  550. $sAction = 'deferred';
  551. $aParams = $this->_alertParamsAdd($aContentInfo);
  552. /**
  553. * @hooks
  554. * @hookdef hook-system-prepare_alert_params 'system', 'prepare_alert_params' - hook to override alert (hook) params
  555. * - $unit_name - equals `system`
  556. * - $action - equals `prepare_alert_params`
  557. * - $object_id - not used
  558. * - $sender_id - not used
  559. * - $extra_params - array of additional params with the following array keys:
  560. * - `unit` - [string] unit name
  561. * - `action` - [string] by ref, action, can be overridden in hook processing
  562. * - `object_id` - [int] by ref, object id, can be overridden in hook processing
  563. * - `sender_id` - [int] by ref, action performer profile id, can be overridden in hook processing
  564. * - `extras` - [array] by ref, extra params array as key&value pairs, can be overridden in hook processing
  565. * @hook @ref hook-system-prepare_alert_params
  566. */
  567. bx_alert('system', 'prepare_alert_params', 0, 0, [
  568. 'unit'=> $this->getName(),
  569. 'action' => &$sAction,
  570. 'object_id' => &$iId,
  571. 'sender_id' => &$iAuthorId,
  572. 'extras' => &$aParams
  573. ]);
  574. /**
  575. * @hooks
  576. * @hookdef hook-bx_base_text-added '{module_name}', 'added' - hook after content was added (published)
  577. * - $unit_name - module name
  578. * - $action - equals `added`
  579. * - $object_id - content id
  580. * - $sender_id - content author profile id
  581. * - $extra_params - array of additional params with the following array keys:
  582. * - `status` - [string] content status
  583. * - `status_admin` - [string] content admin status
  584. * - `privacy_view` - [int] or [string] privacy for view content action, @see BxDolPrivacy
  585. * - `cf` - [int] content's audience filter value
  586. * @hook @ref hook-bx_base_text-added
  587. */
  588. /**
  589. * @hooks
  590. * @hookdef hook-bx_base_text-deferred '{module_name}', 'deferred' - hook after content was added with pending approval status
  591. * It's equivalent to @ref hook-bx_base_text-added
  592. * @hook @ref hook-bx_base_text-deferred
  593. */
  594. bx_alert($this->getName(), $sAction, $iId, $iAuthorId, $aParams);
  595. $this->_processModerationNotifications($aContentInfo);
  596. }
  597. public function alertAfterEdit($aContentInfo)
  598. {
  599. $CNF = &$this->_oConfig->CNF;
  600. $iId = (int)$aContentInfo[$CNF['FIELD_ID']];
  601. $aParams = $this->_alertParamsEdit($aContentInfo);
  602. /**
  603. * @hooks
  604. * @hookdef hook-bx_base_text-edited '{module_name}', 'edited' - hook after content was changed
  605. * It's equivalent to @ref hook-bx_base_text-added
  606. * @hook @ref hook-bx_base_text-edited
  607. */
  608. bx_alert($this->getName(), 'edited', $iId, false, $aParams);
  609. }
  610. /**
  611. * Get array of params to be passed in Add/Edit Alert.
  612. */
  613. protected function _alertParams($aContentInfo)
  614. {
  615. $aParams = parent::_alertParams($aContentInfo);
  616. $CNF = &$this->_oConfig->CNF;
  617. if(!empty($CNF['FIELD_STATUS']) && isset($aContentInfo[$CNF['FIELD_STATUS']]))
  618. $aParams['status'] = $aContentInfo[$CNF['FIELD_STATUS']];
  619. if(!empty($CNF['FIELD_STATUS_ADMIN']) && isset($aContentInfo[$CNF['FIELD_STATUS_ADMIN']]))
  620. $aParams['status_admin'] = $aContentInfo[$CNF['FIELD_STATUS_ADMIN']];
  621. if(!empty($CNF['FIELD_ALLOW_VIEW_TO']) && isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
  622. $aParams['privacy_view'] = $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']];
  623. if(!empty($CNF['FIELD_CF']) && isset($aContentInfo[$CNF['FIELD_CF']]))
  624. $aParams['cf'] = $aContentInfo[$CNF['FIELD_CF']];
  625. return $aParams;
  626. }
  627. protected function _alertParamsAdd($aContentInfo)
  628. {
  629. $aParams = $this->_alertParams($aContentInfo);
  630. $CNF = &$this->_oConfig->CNF;
  631. if(!empty($CNF['OBJECT_METATAGS']))
  632. $aParams['timeline_group'] = $this->_getAlertParamTimelineGroup($aContentInfo);
  633. return $aParams;
  634. }
  635. protected function _alertParamsEdit($aContentInfo)
  636. {
  637. $aParams = $this->_alertParams($aContentInfo);
  638. $CNF = &$this->_oConfig->CNF;
  639. if(!empty($CNF['OBJECT_METATAGS']))
  640. $aParams['timeline_group'] = $this->_getAlertParamTimelineGroup($aContentInfo);
  641. return $aParams;
  642. }
  643. protected function _getAlertParamTimelineGroup($aContentInfo)
  644. {
  645. $CNF = &$this->_oConfig->CNF;
  646. return [
  647. 'by' => $this->getName() . '_' . abs((int)$aContentInfo[$CNF['FIELD_AUTHOR']]) . '_' . (int)$aContentInfo[$CNF['FIELD_ID']],
  648. 'field' => 'owner_id'
  649. ];
  650. }
  651. public function getPollForm()
  652. {
  653. $CNF = &$this->_oConfig->CNF;
  654. if(empty($CNF['OBJECT_FORM_POLL']))
  655. return array('code' => 1, 'message' => '_sys_txt_error_occured');
  656. $iProfileId = bx_get_logged_profile_id();
  657. $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_POLL'], $CNF['OBJECT_FORM_POLL_DISPLAY_ADD'], $this->_oTemplate);
  658. $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'submit_poll_form/';
  659. $oForm->initChecker();
  660. if($oForm->isSubmittedAndValid()) {
  661. $iId = $oForm->insert();
  662. if($iId)
  663. return array('code' => 0, 'id' => $iId, 'item' => $this->_oTemplate->getPollItem($iId, $iProfileId, array(
  664. 'manage' => true
  665. )));
  666. else
  667. return array('code' => 2, 'message' => '_sys_txt_error_entry_creation');
  668. }
  669. return array('form' => $oForm->getCode(), 'form_id' => $oForm->id);
  670. }
  671. public function getEntryImageData($aContentInfo, $sField = 'FIELD_THUMB', $aTranscoders = array())
  672. {
  673. $CNF = &$this->_oConfig->CNF;
  674. $mResult = parent::getEntryImageData($aContentInfo, $sField, $aTranscoders);
  675. if ($mResult === false && isset($CNF['PARAM_USE_GALERY_AS_COVER']) && getParam($CNF['PARAM_USE_GALERY_AS_COVER']) == 'on'){
  676. if(!empty($CNF['OBJECT_STORAGE_PHOTOS']) && !empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS'])){
  677. $sStorage = $CNF['OBJECT_STORAGE_PHOTOS'];
  678. $oStorage = BxDolStorage::getObjectInstance($sStorage);
  679. $aGhostFiles = $oStorage->getGhosts ($this->serviceGetContentOwnerProfileId($aContentInfo[$CNF['FIELD_ID']]), $aContentInfo[$CNF['FIELD_ID']]);
  680. if ($aGhostFiles){
  681. foreach ($aGhostFiles as $k => $a) {
  682. return array('id' => $a['id'], 'transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']);
  683. }
  684. }
  685. }
  686. }
  687. return $mResult;
  688. }
  689. public function decodeDataAPI($aData, $aParams = [])
  690. {
  691. $CNF = &$this->_oConfig->CNF;
  692. $sModule = $this->getName();
  693. $iId = (int)$aData[$CNF['FIELD_ID']];
  694. $sSummary = '';
  695. if(!empty($CNF['PARAM_CHARS_SUMMARY_PLAIN'])) {
  696. $sSummary = $this->_oTemplate->getText($aData);
  697. $sSummary = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int)getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN']));
  698. }
  699. $aResult = [
  700. 'id' => $iId,
  701. 'module' => $sModule,
  702. 'module_title' => _t($CNF['T']['txt_sample_single']),
  703. 'added' => $aData[$CNF['FIELD_ADDED']],
  704. 'author' => $aData[$CNF['FIELD_AUTHOR']],
  705. 'author_data' => !empty($aData[$CNF['FIELD_AUTHOR']]) ? BxDolProfile::getData($aData[$CNF['FIELD_AUTHOR']]) : '',
  706. 'title' => $aData[$CNF['FIELD_TITLE']],
  707. 'url' => bx_api_get_relative_url($this->serviceGetLink($iId)),
  708. 'image' => $this->serviceGetThumb($iId),
  709. 'summary_plain' => $sSummary
  710. ];
  711. if(isset($aParams['extended']) && $aParams['extended'] === true)
  712. $aResult['text'] = $aData[$CNF['FIELD_TEXT']];
  713. if(!empty($CNF['OBJECT_MENU_SNIPPET_META']) && ($oMetaMenu = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SNIPPET_META'], $this->_oTemplate)) !== false) {
  714. $oMetaMenu->setContentId($iId);
  715. $aResult['meta'] = $oMetaMenu->getCodeAPI();
  716. }
  717. return $aResult;
  718. }
  719. // ====== PROTECTED METHODS
  720. protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  721. {
  722. $CNF = &$this->_oConfig->CNF;
  723. $aResults = parent::_getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  724. if (bx_is_api())
  725. return $aResults;
  726. if (count($aResults) == 0 && isset($CNF['PARAM_USE_GALERY_AS_COVER']) && getParam($CNF['PARAM_USE_GALERY_AS_COVER']) == 'on'){
  727. $aResults = $this->_getImagesForTimelinePostAttachInner($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  728. if (count($aResults) > 1){
  729. $aResults = array_slice($aResults, 0, 1);
  730. }
  731. }
  732. return $aResults;
  733. }
  734. protected function _getImagesForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  735. {
  736. $CNF = &$this->_oConfig->CNF;
  737. $aTmp = parent::_getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  738. $aResults = $this->_getImagesForTimelinePostAttachInner($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  739. if (bx_is_api())
  740. return $aResults;
  741. if (count($aTmp) == 0 && count($aResults) > 0 && isset($CNF['PARAM_USE_GALERY_AS_COVER']) && getParam($CNF['PARAM_USE_GALERY_AS_COVER']) == 'on'){
  742. $aResults = array_slice($aResults, 1);
  743. }
  744. return $aResults;
  745. }
  746. protected function _getImagesForTimelinePostAttachInner($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  747. {
  748. $CNF = &$this->_oConfig->CNF;
  749. $aResults = parent::_getImagesForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  750. if(!$this->_oConfig->isAttachmentsInTimeline() || empty($CNF['OBJECT_STORAGE_PHOTOS']) || empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']))
  751. return $aResults;
  752. $iContentId = (int)$aContentInfo[$CNF['FIELD_ID']];
  753. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE_PHOTOS']);
  754. $aGhostFiles = $oStorage->getGhosts($this->serviceGetContentOwnerProfileId($iContentId), $iContentId);
  755. if(!$aGhostFiles)
  756. return [];
  757. $oTranscoderSm = false;
  758. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_MINIATURE_PHOTOS']))
  759. $oTranscoderSm = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_MINIATURE_PHOTOS']);
  760. $oTranscoderMd = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']);
  761. $oTranscoderXl = false;
  762. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_VIEW_PHOTOS']))
  763. $oTranscoderXl = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_VIEW_PHOTOS']);
  764. foreach($aGhostFiles as $k => $a) {
  765. $sPhotoSrcMd = $oTranscoderMd->getFileUrl($a['id']);
  766. if(empty($sPhotoSrcMd))
  767. continue;
  768. $sPhotoSrcSm = $oTranscoderSm !== false ? $oTranscoderSm->getFileUrl($a['id']) : '';
  769. if(!$sPhotoSrcSm)
  770. $sPhotoSrcSm = $sPhotoSrcMd;
  771. $sPhotoSrcXl = $oTranscoderXl !== false ? $oTranscoderXl->getFileUrl($a['id']) : $oStorage->getFileUrlById($a['id']);
  772. if(!$sPhotoSrcXl)
  773. $sPhotoSrcXl = $sPhotoSrcMd;
  774. if (bx_is_api()){
  775. $aResults[] = bx_api_get_image($CNF['OBJECT_STORAGE_PHOTOS'], (int)$a['id']);
  776. }
  777. else{
  778. $aResults[] = [
  779. 'id' => $a['id'],
  780. 'src' => $sPhotoSrcMd,
  781. 'src_small' => $sPhotoSrcSm,
  782. 'src_medium' => $sPhotoSrcMd,
  783. 'src_orig' => $sPhotoSrcXl,
  784. ];
  785. }
  786. }
  787. return $aResults;
  788. }
  789. protected function _getVideosForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  790. {
  791. $CNF = &$this->_oConfig->CNF;
  792. $aResults = parent::_getVideosForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  793. if(!$this->_oConfig->isAttachmentsInTimeline() || empty($CNF['OBJECT_STORAGE_VIDEOS']) || empty($CNF['OBJECT_VIDEOS_TRANSCODERS']))
  794. return $aResults;
  795. $iContentId = (int)$aContentInfo[$CNF['FIELD_ID']];
  796. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE_VIDEOS']);
  797. $aGhostFiles = $oStorage->getGhosts($this->serviceGetContentOwnerProfileId($iContentId), $iContentId);
  798. if(!$aGhostFiles)
  799. return array();
  800. $oTcPoster = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']);
  801. $oTcMp4 = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']);
  802. $oTcMp4Hd = BxDolTranscoderVideo::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4_hd']);
  803. if(!$oTcPoster || !$oTcMp4 || !$oTcMp4Hd)
  804. return array();
  805. $aResults = array();
  806. foreach ($aGhostFiles as $k => $a) {
  807. $sVideoUrl = $oStorage->getFileUrlById($a['id']);
  808. $aVideoFile = $oStorage->getFile($a['id']);
  809. $sVideoUrlHd = '';
  810. if (!empty($aVideoFile['dimensions']) && $oTcMp4Hd->isProcessHD($aVideoFile['dimensions']))
  811. $sVideoUrlHd = $oTcMp4Hd->getFileUrl($a['id']);
  812. $aResults[$a['id']] = array(
  813. 'id' => $a['id'],
  814. 'src_poster' => $oTcPoster->getFileUrl($a['id']),
  815. 'src_mp4' => $oTcMp4->getFileUrl($a['id']),
  816. 'src_mp4_hd' => $sVideoUrlHd,
  817. );
  818. }
  819. return $aResults;
  820. }
  821. protected function _getFilesForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
  822. {
  823. $CNF = &$this->_oConfig->CNF;
  824. $aResults = parent::_getFilesForTimelinePostAttach($aEvent, $aContentInfo, $sUrl, $aBrowseParams);
  825. if(!$this->_oConfig->isAttachmentsInTimeline() || empty($CNF['OBJECT_STORAGE_FILES']))
  826. return $aResults;
  827. $iContentId = (int)$aContentInfo[$CNF['FIELD_ID']];
  828. $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE_FILES']);
  829. $aGhostFiles = $oStorage->getGhosts($this->serviceGetContentOwnerProfileId($iContentId), $iContentId);
  830. if(!$aGhostFiles)
  831. return array();
  832. $oTranscoder = null;
  833. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']))
  834. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']);
  835. foreach ($aGhostFiles as $k => $a) {
  836. $bImage = in_array($a['ext'], array('jpg', 'jpeg', 'png', 'gif'));
  837. $sPhotoSrc = '';
  838. if($bImage && $oTranscoder)
  839. $sPhotoSrc = $oTranscoder->getFileUrl($a['id']);
  840. if(empty($sPhotoSrc) && $oStorage)
  841. $sPhotoSrc = $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($a['file_name']));
  842. $sUrl = $oStorage->getFileUrlById($a['id']);
  843. $aResults[] = array(
  844. 'id' => $a['id'],
  845. 'src' => $sPhotoSrc,
  846. 'src_medium' => $sPhotoSrc,
  847. 'src_orig' => $bImage ? $sUrl : '',
  848. 'url' => !$bImage ? $sUrl : ''
  849. );
  850. }
  851. return $aResults;
  852. }
  853. protected function _getContentForTimelinePost($aEvent, $aContentInfo, $aBrowseParams = array())
  854. {
  855. $aResult = parent::_getContentForTimelinePost($aEvent, $aContentInfo, $aBrowseParams);
  856. if(!$this->_oConfig->isAttachmentsInTimeline())
  857. return $aResult;
  858. $CNF = &$this->_oConfig->CNF;
  859. $bDynamic = isset($aBrowseParams['dynamic_mode']) && (bool)$aBrowseParams['dynamic_mode'] === true;
  860. if(!empty($CNF['PARAM_POLL_ENABLED']) && $CNF['PARAM_POLL_ENABLED'] == true)
  861. $aPolls = $this->_oDb->getPolls(array('type' => 'content_id', 'content_id' => (int)$aContentInfo[$CNF['FIELD_ID']]));
  862. if(!empty($aPolls) && is_array($aPolls)) {
  863. $sInclude = $this->_oTemplate->addCss(array('polls.css'), $bDynamic);
  864. $aResult['raw'] = ($bDynamic ? $sInclude : '') . $this->_oTemplate->parseHtmlByName('poll_items_embed.html', array(
  865. 'embed_url' => BX_DOL_URL_ROOT . bx_append_url_params($this->_oConfig->getBaseUri() . 'embed_polls/', array(
  866. 'id' => (int)$aContentInfo[$CNF['FIELD_ID']],
  867. 'param_switch_menu' => 0,
  868. 'param_showcase' => 1
  869. ))
  870. ));
  871. /*
  872. if((!empty($aResult['videos']) && is_array($aResult['videos'])) || (!empty($aResult['videos_attach']) && is_array($aResult['videos_attach'])))
  873. $aResult['_cache'] = false;
  874. */
  875. }
  876. return $aResult;
  877. }
  878. protected function _buildRssParams($sMode, $aArgs)
  879. {
  880. $aParams = array ();
  881. $sMode = bx_process_input($sMode);
  882. switch ($sMode) {
  883. case 'author':
  884. $aParams = array('author' => isset($aArgs[0]) ? (int)$aArgs[0] : '');
  885. break;
  886. }
  887. return $aParams;
  888. }
  889. public function serviceIsAllowedPostInContext()
  890. {
  891. return true;
  892. }
  893. }
  894. /** @} */