X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FQnA%2Factions%2Fqnavote.php;h=6cda1ff827fef15e8d008a04411f793424a029e9;hb=0ddc2fc41794dbf062a35218bb12ec836e8cf961;hp=17e841e5454fd798c33a7ddc3183e894ed5231da;hpb=f9cf1dddfe81f5ad61f89f8080d418ced27ecb5f;p=quix0rs-gnu-social.git diff --git a/plugins/QnA/actions/qnavote.php b/plugins/QnA/actions/qnavote.php index 17e841e545..6cda1ff827 100644 --- a/plugins/QnA/actions/qnavote.php +++ b/plugins/QnA/actions/qnavote.php @@ -3,7 +3,7 @@ * StatusNet - the distributed open-source microblogging tool * Copyright (C) 2011, StatusNet, Inc. * - * Answer a question + * Vote on a question or answer * * PHP version 5 * @@ -20,7 +20,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - * @category QuestonAndAnswer + * @category QnA * @package StatusNet * @author Zach Copley * @copyright 2011 StatusNet, Inc. @@ -34,7 +34,7 @@ if (!defined('STATUSNET')) { } /** - * Answer a question + * Vote on a question or answer * * @category QnA * @package StatusNet @@ -43,13 +43,13 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ -class AnswerAction extends Action +class Qnavote extends Action { protected $user = null; protected $error = null; protected $complete = null; - protected $qustion = null; + protected $question = null; protected $answer = null; /** @@ -81,7 +81,7 @@ class AnswerAction extends Action if (empty($this->user)) { // TRANS: Client exception thrown trying to answer a question while not logged in. - throw new ClientException(_m("You must be logged in to answer to a question."), + throw new ClientException(_m('You must be logged in to answer to a question.'), 403); } @@ -90,7 +90,7 @@ class AnswerAction extends Action } $id = $this->trimmed('id'); - $this->question = Question::staticGet('id', $id); + $this->question = QnA_Question::getKV('id', $id); if (empty($this->question)) { // TRANS: Client exception thrown trying to respond to a non-existing question. throw new ClientException(_m('Invalid or missing question.'), 404); @@ -142,20 +142,18 @@ class AnswerAction extends Action } if ($this->boolean('ajax')) { - header('Content-Type: text/xml;charset=utf-8'); - $this->xw->startDocument('1.0', 'UTF-8'); - $this->elementStart('html'); + $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); - // TRANS: Page title after sending an answer. + // TRANS: Page title after sending in a vote for a question or answer. $this->element('title', null, _m('Answers')); $this->elementEnd('head'); $this->elementStart('body'); - $form = new Answer($this->question, $this); + $form = new QnA_Answer($this->question, $this); $form->show(); $this->elementEnd('body'); - $this->elementEnd('html'); + $this->endHTML(); } else { - common_redirect($this->question->bestUrl(), 303); + common_redirect($this->question->getUrl(), 303); } } @@ -170,7 +168,7 @@ class AnswerAction extends Action $this->element('p', 'error', $this->error); } - $form = new AnswerForm($this->question, $this); + $form = new QnaanswerForm($this->question, $this); $form->show();