X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshownotice.php;h=9c5d83441b8688e6ed08b52cf22c9dfdf71f6ba5;hb=fe5f55cc24d23848644af2ff212292e96545b940;hp=d09100f676aaf473e46e54aadd409f6ff1b1eb0c;hpb=a180658a3bfcf2b7b312058e3aa76e0e2467c2f8;p=quix0rs-gnu-social.git diff --git a/actions/shownotice.php b/actions/shownotice.php index d09100f676..9c5d83441b 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -97,17 +97,12 @@ class ShownoticeAction extends OwnerDesignAction $this->profile = $this->notice->getProfile(); if (empty($this->profile)) { - $this->serverError(_('Notice has no profile'), 500); + $this->serverError(_('Notice has no profile.'), 500); return false; } $this->user = User::staticGet('id', $this->profile->id); - if ($this->notice->is_local == Notice::REMOTE_OMB) { - common_redirect($this->notice->uri); - return false; - } - $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); return true; @@ -172,7 +167,7 @@ class ShownoticeAction extends OwnerDesignAction function title() { if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') '; + $base = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; } else { $base = $this->profile->nickname; } @@ -198,13 +193,20 @@ class ShownoticeAction extends OwnerDesignAction if ($this->notice->is_local == Notice::REMOTE_OMB) { if (!empty($this->notice->url)) { - common_redirect($this->notice->url, 301); + $target = $this->notice->url; } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { - common_redirect($this->notice->uri, 301); + // Old OMB posts saved the remote URL only into the URI field. + $target = $this->notice->uri; + } else { + // Shouldn't happen. + $target = false; + } + if ($target && $target != $this->selfUrl()) { + common_redirect($target, 301); + return false; } - } else { - $this->showPage(); } + $this->showPage(); } /**