- $anon = $_SESSION['anon_nickname'];
- $profile = Profile::staticGet('nickname', $anon);
-
- if (empty($profile)) {
- common_debug(
- "AnonFavorAction - Anon user tried to fave a notice but doesn't have a profile."
- );
- }
+ $profile = AnonymousFavePlugin::getAnonProfile();
$token = $this->trimmed('token-' . $notice->id);
if (empty($token) || $token != common_session_token()) {
$token = $this->trimmed('token-' . $notice->id);
if (empty($token) || $token != common_session_token()) {
$this->clientError(_m('There was a problem with your session token. Try again, please.'));
return;
}
if ($profile->hasFave($notice)) {
$this->clientError(_m('There was a problem with your session token. Try again, please.'));
return;
}
if ($profile->hasFave($notice)) {
$this->clientError(_m('This notice is already a favorite!'));
return;
}
$fave = Fave::addNew($profile, $notice);
if (!$fave) {
$this->clientError(_m('This notice is already a favorite!'));
return;
}
$fave = Fave::addNew($profile, $notice);
if (!$fave) {
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
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');
$this->element('title', null, _m('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');