BxBaseModConnectAlerts.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup BaseConnect Base classes for OAuth connect modules
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModConnectAlerts extends BxDolAlertsResponse
  12. {
  13. protected $oModule;
  14. public function response($o)
  15. {
  16. if ($o->sUnit == 'profile') {
  17. switch ($o->sAction) {
  18. case 'delete':
  19. // remove remote account
  20. $this->oModule->_oDb->deleteRemoteAccount($o->iObject);
  21. break;
  22. case 'add':
  23. // add remote account and local profile association
  24. bx_import('BxDolSession');
  25. $oSession = BxDolSession::getInstance();
  26. $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid);
  27. if ($iRemoteProfileId) {
  28. $oSession->unsetValue($this->oModule->_oConfig->sSessionUid);
  29. $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId);
  30. }
  31. break;
  32. }
  33. }
  34. }
  35. }
  36. /** @} */