<?php
-
/**
* Anonymous disfavor action
*
{
parent::handle($args);
- $anon = $_SESSION['anon_nickname'];
-
- $profile = Profile::staticGet('nickname', $anon);
-
- if (empty($profile)) {
- common_debug(
- "AnonDisFavorAction - Anon user tried to disfave a notice but doesn't have a profile."
- );
- }
+ $profile = AnonymousFavePlugin::getAnonProfile();
if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
+ // TRANS: Client error.
_m('Could not disfavor notice! Please make sure your browser has cookies enabled.')
);
return;
}
$id = $this->trimmed('notice');
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
$token = $this->trimmed('token-' . $notice->id);
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error.
$this->clientError(_m('There was a problem with your session token. Try again, please.'));
return;
}
$fave->notice_id = $notice->id;
if (!$fave->find(true)) {
+ // TRANS: Client error.
$this->clientError(_m('This notice is not a favorite!'));
return;
}
if (!$result) {
common_log_db_error($fave, 'DELETE', __FILE__);
+ // TRANS: Server error.
$this->serverError(_m('Could not delete favorite.'));
return;
}
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
+ // TRANS: Title.
$this->element('title', null, _m('Add to favorites'));
$this->elementEnd('head');
$this->elementStart('body');
}
}
}
-