favcommand.php 662 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class FavCommand extends Command
  3. {
  4. var $other = null;
  5. function __construct($user, $other)
  6. {
  7. parent::__construct($user);
  8. $this->other = $other;
  9. }
  10. function handle($channel)
  11. {
  12. $notice = $this->getNotice($this->other);
  13. try {
  14. $fave = Fave::addNew($this->user->getProfile(), $notice);
  15. } catch (Exception $e) {
  16. $channel->error($this->user, $e->getMessage());
  17. return;
  18. }
  19. // TRANS: Text shown when a notice has been marked as favourite successfully.
  20. $channel->output($this->user, _('Notice marked as fave.'));
  21. }
  22. }