]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/actions/qnavote.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / QnA / actions / qnavote.php
index 8098cb87d0d97ae1542498e594204edb8478447d..00395d82e50f418528559537ce04ba61cbd97d2f 100644 (file)
@@ -3,7 +3,7 @@
  * StatusNet - the distributed open-source microblogging tool
  * Copyright (C) 2011, StatusNet, Inc.
  *
- * Vote on a questino or answer
+ * Vote on a question or answer
  *
  * PHP version 5
  *
@@ -74,14 +74,14 @@ class Qnavote extends Action
     {
         parent::prepare($argarray);
         if ($this->boolean('ajax')) {
-            StatusNet::setApi(true);
+            GNUsocial::setApi(true);
         }
 
         $this->user = common_current_user();
 
         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 Qnavote extends Action
         }
 
         $id = $this->trimmed('id');
-        $this->question = QnA_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 Qnavote 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 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);
         }
     }
 
@@ -186,7 +184,7 @@ class Qnavote extends Action
      *
      * @return boolean is read only action?
      */
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
             $_SERVER['REQUEST_METHOD'] == 'HEAD') {