sensitivecontentsettings.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. class SensitiveContentSettingsAction extends SettingsAction
  4. {
  5. function title()
  6. {
  7. return _m('Sensitive content settings');
  8. }
  9. function getInstructions()
  10. {
  11. return _m('Set preferences for display of "sensitive" content');
  12. }
  13. function showContent()
  14. {
  15. $user = $this->scoped->getUser();
  16. $this->elementStart('form', array('method' => 'post',
  17. 'id' => 'sensitivecontent',
  18. 'class' => 'form_settings',
  19. 'action' => common_local_url('sensitivecontentsettings')));
  20. $this->elementStart('fieldset');
  21. $this->hidden('token', common_session_token());
  22. $this->elementStart('ul', 'form_data');
  23. $this->elementStart('li');
  24. $this->checkbox('hidesensitive', _('Hide attachments in posts hashtagged #NSFW'),
  25. ($this->arg('hidesensitive')) ?
  26. $this->boolean('hidesensitive') : $this->scoped->getPref('MoonMan','hide_sensitive',0));
  27. $this->elementEnd('li');
  28. $this->elementEnd('ul');
  29. $this->submit('save', _m('BUTTON','Save'));
  30. $this->elementEnd('fieldset');
  31. $this->elementEnd('form');
  32. }
  33. function doPost()
  34. {
  35. $hidesensitive = $this->booleanintstring('hidesensitive');
  36. $this->scoped->setPref('MoonMan','hide_sensitive', $hidesensitive);
  37. return _('Settings saved.');
  38. }
  39. }