X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FPoll%2Fshowpoll.php;h=edfe3fe245f8520105184c231a43ec2e40a2873d;hb=19b965d99188fde59cdd39b668df8951bc0f180c;hp=60669f96ff663c1a7fd7f2f0a0a5b8388291eca6;hpb=a70914cd579c9f600545cd5166ffbd36619aa856;p=quix0rs-gnu-social.git diff --git a/plugins/Poll/showpoll.php b/plugins/Poll/showpoll.php index 60669f96ff..edfe3fe245 100644 --- a/plugins/Poll/showpoll.php +++ b/plugins/Poll/showpoll.php @@ -48,47 +48,26 @@ class ShowPollAction extends ShownoticeAction { protected $poll = null; - /** - * For initializing members of the class. - * - * @param array $argarray misc. arguments - * - * @return boolean true - */ - function prepare($argarray) + function getNotice() { - OwnerDesignAction::prepare($argarray); - $this->id = $this->trimmed('id'); $this->poll = Poll::staticGet('id', $this->id); if (empty($this->poll)) { + // TRANS: Client exception thrown trying to view a non-existing poll. throw new ClientException(_m('No such poll.'), 404); } - $this->notice = $this->poll->getNotice(); + $notice = $this->poll->getNotice(); - if (empty($this->notice)) { + if (empty($notice)) { // Did we used to have it, and it got deleted? + // TRANS: Client exception thrown trying to view a non-existing poll notice. throw new ClientException(_m('No such poll notice.'), 404); } - $this->user = User::staticGet('id', $this->poll->profile_id); - - if (empty($this->user)) { - throw new ClientException(_m('No such user.'), 404); - } - - $this->profile = $this->user->getProfile(); - - if (empty($this->profile)) { - throw new ServerException(_m('User without a profile.')); - } - - $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); - - return true; + return $notice; } /** @@ -100,7 +79,9 @@ class ShowPollAction extends ShownoticeAction */ function title() { - return sprintf(_m('%s\'s poll: %s'), + // TRANS: Page title for a poll. + // TRANS: %1$s is the nickname of the user that created the poll, %2$s is the poll question. + return sprintf(_m('%1$s\'s poll: %2$s'), $this->user->nickname, $this->poll->question); }