common_redirect and clientError exits, so refactor

One Event would never be called, and other stuff were redundant clauses.
This commit is contained in:
Mikael Nordfeldth 2014-03-09 23:22:05 +01:00
parent 8d655bc706
commit acbe94936f
4 changed files with 15 additions and 20 deletions

View File

@ -37,15 +37,15 @@ class UserrssAction extends Rss10Action
if (!$this->user) {
// TRANS: Client error displayed when user not found for an action.
$this->clientError(_('No such user.'));
return false;
} else {
if (!empty($this->tag)) {
$this->notices = $this->getTaggedNotices();
} else {
$this->notices = $this->getNotices();
}
return true;
}
if (!empty($this->tag)) {
$this->notices = $this->getTaggedNotices();
} else {
$this->notices = $this->getNotices();
}
return true;
}
function getTaggedNotices()

View File

@ -332,9 +332,9 @@ class EmailregisterAction extends Action
}
if (Event::handle('StartRegisterSuccess', array($this))) {
common_redirect(common_local_url('doc', array('title' => 'welcome')),
303);
Event::handle('EndRegisterSuccess', array($this));
common_redirect(common_local_url('doc', array('title' => 'welcome')), 303);
// common_redirect exits, so we can't run the event _after_ it of course.
}
}

View File

@ -54,12 +54,7 @@ class FacebookfinishloginAction extends Action
$graphUrl = 'https://graph.facebook.com/me?access_token=' . urlencode($this->accessToken);
$this->fbuser = json_decode(file_get_contents($graphUrl));
if (!empty($this->fbuser)) {
$this->fbuid = $this->fbuser->id;
// OKAY, all is well... proceed to register
return true;
} else {
if (empty($this->fbuser)) {
// log badness
list($proxy, $ip) = common_client_ip();
@ -80,7 +75,9 @@ class FacebookfinishloginAction extends Action
);
}
return false;
$this->fbuid = $this->fbuser->id;
// OKAY, all is well... proceed to register
return true;
}
function handle($args)

View File

@ -179,8 +179,7 @@ class EditphotoAction extends Action
return;
}
common_redirect('/photo/' . $this->photo->id, '303');
$this->showForm(_('Success!'), true);
// common_redirect exits
}
function deletePhoto()
@ -198,7 +197,6 @@ class EditphotoAction extends Action
}
$this->showForm(_('Success!'));
common_redirect('/' . $this->user->nickname . '/photos/' . $oldalbum, '303');
return;
}
}