BxAnonFollowDb.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 AnonymousFollow Anonymous Follow
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAnonFollowDb extends BxBaseModGeneralDb
  12. {
  13. function __construct(&$oConfig)
  14. {
  15. parent::__construct($oConfig);
  16. }
  17. public function addFollower($iInitiator, $iContent)
  18. {
  19. $CNF = &$this->_oConfig->CNF;
  20. $aBindings = array(
  21. 'initiator' => $iInitiator,
  22. 'content' => $iContent,
  23. 'added' => time()
  24. );
  25. $this->query("INSERT INTO `" . $CNF['TABLE_ENTRIES'] . "` (`" . $CNF['FIELD_INITIATOR'] . "`, `" . $CNF['FIELD_CONTENT'] . "`, `" . $CNF['FIELD_ADDED'] . "`) values (:initiator, :content, :added)", $aBindings);
  26. }
  27. public function removeFollower($iInitiator, $iContent)
  28. {
  29. $CNF = &$this->_oConfig->CNF;
  30. $aBindings = array(
  31. 'initiator' => $iInitiator,
  32. 'content' => $iContent
  33. );
  34. $this->query("DELETE FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_INITIATOR'] . "` = :initiator AND `" . $CNF['FIELD_CONTENT'] . "`= :content", $aBindings);
  35. }
  36. }
  37. /** @} */