BxBaseModProfileCmts.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 BaseProfile Base classes for profile modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModProfileCmts extends BxTemplCmts
  12. {
  13. protected $_sModule;
  14. protected $_oModule;
  15. function __construct($sSystem, $iId, $iInit = 1)
  16. {
  17. parent::__construct($sSystem, $iId, $iInit);
  18. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  19. }
  20. public function isPostAllowed ($isPerformAction = false)
  21. {
  22. $bCheckResult = $this->_isPostAllowed ($isPerformAction);
  23. bx_alert($this->_sModule, 'comment_post_allowed', $this->getId(), false, array('check_result' => &$bCheckResult));
  24. return $bCheckResult;
  25. }
  26. protected function _isPostAllowed ($isPerformAction = false)
  27. {
  28. $CNF = &$this->_oModule->_oConfig->CNF;
  29. $oProfileOwner = BxDolProfile::getInstanceByContentAndType($this->getId(), $this->_sModule);
  30. if($oProfileOwner !== false && $oProfileOwner->checkAllowedPostInProfile() !== CHECK_ACTION_RESULT_ALLOWED)
  31. return false;
  32. return parent::isPostAllowed($isPerformAction);
  33. }
  34. }
  35. /** @} */