From acbe94936f6d9edf24781550e2eabef24d13c455 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 9 Mar 2014 23:22:05 +0100 Subject: [PATCH] common_redirect and clientError exits, so refactor One Event would never be called, and other stuff were redundant clauses. --- actions/userrss.php | 16 ++++++++-------- .../EmailRegistration/actions/emailregister.php | 4 ++-- .../actions/facebookfinishlogin.php | 11 ++++------- plugins/GNUsocialPhotos/actions/editphoto.php | 4 +--- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/actions/userrss.php b/actions/userrss.php index 3a7332088d..308db94891 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -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() diff --git a/plugins/EmailRegistration/actions/emailregister.php b/plugins/EmailRegistration/actions/emailregister.php index 5eaf84ad54..39eb76d599 100644 --- a/plugins/EmailRegistration/actions/emailregister.php +++ b/plugins/EmailRegistration/actions/emailregister.php @@ -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. } } diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php index 66ac174ef2..ab83601ce1 100644 --- a/plugins/FacebookBridge/actions/facebookfinishlogin.php +++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php @@ -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) diff --git a/plugins/GNUsocialPhotos/actions/editphoto.php b/plugins/GNUsocialPhotos/actions/editphoto.php index 7ac8104ae8..8f719919f9 100644 --- a/plugins/GNUsocialPhotos/actions/editphoto.php +++ b/plugins/GNUsocialPhotos/actions/editphoto.php @@ -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; } }