123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class AnonFavorAction extends RedirectingAction
- {
-
- function handle()
- {
- parent::handle();
- $profile = AnonymousFavePlugin::getAnonProfile();
- if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
-
- $this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.'));
- }
- $id = $this->trimmed('notice');
- $notice = Notice::getKV($id);
- $token = $this->checkSessionToken();
-
- $stored = Fave::addNew($profile, $notice);
- if ($this->boolean('ajax')) {
- $this->startHTML('text/xml;charset=utf-8');
- $this->elementStart('head');
-
- $this->element('title', null, _m('Disfavor favorite'));
- $this->elementEnd('head');
- $this->elementStart('body');
- $disfavor = new AnonDisFavorForm($this, $notice);
- $disfavor->show();
- $this->elementEnd('body');
- $this->endHTML();
- } else {
- $this->returnToPrevious();
- }
- }
-
- function defaultReturnTo()
- {
- $returnto = common_get_returnto();
- if (empty($returnto)) {
- return common_local_url('public');
- } else {
- return $returnto;
- }
- }
- }
|