]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/actions/qnareviseanswer.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / QnA / actions / qnareviseanswer.php
index 993543c99503df521ced7c0db9a1f57866006c85..92fcfd8c92997afbfc236caf650c284ab82daaa0 100644 (file)
@@ -73,14 +73,14 @@ class QnareviseanswerAction 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(
+                // TRANS: Client exception thrown trying to answer a question while not logged in.
                 _m("You must be logged in to answer to a question."),
                 403
             );
@@ -88,12 +88,12 @@ class QnareviseanswerAction extends Action
 
         $id = substr($this->trimmed('id'), 7);
 
-        $this->answer   = QnA_Answer::staticGet('id', $id);
+        $this->answer   = QnA_Answer::getKV('id', $id);
         $this->question = $this->answer->getQuestion();
 
         if (empty($this->answer) || empty($this->question)) {
-            // TRANS: Client exception thrown trying to respond to a non-existing question.
             throw new ClientException(
+                // TRANS: Client exception thrown trying to respond to a non-existing question.
                 _m('Invalid or missing answer.'),
                 404
             );
@@ -155,9 +155,7 @@ class QnareviseanswerAction extends Action
         }
         if ($this->boolean('ajax')) {
             common_debug("ajaxy part");
-            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.
             $this->element('title', null, _m('Answer'));
@@ -166,9 +164,9 @@ class QnareviseanswerAction extends Action
             $form = new QnashowanswerForm($this, $answer);
             $form->show();
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
-            common_redirect($this->answer->bestUrl(), 303);
+            common_redirect($this->answer->getUrl(), 303);
         }
     }
 
@@ -199,9 +197,7 @@ class QnareviseanswerAction extends Action
         }
         if ($this->boolean('ajax')) {
             common_debug("ajaxy part");
-            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.
             $this->element('title', null, _m('Answer'));
@@ -210,9 +206,9 @@ class QnareviseanswerAction extends Action
             $form = new QnashowanswerForm($this, $answer);
             $form->show();
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
-            common_redirect($this->answer->bestUrl(), 303);
+            common_redirect($this->answer->getUrl(), 303);
         }
     }
 
@@ -239,17 +235,16 @@ class QnareviseanswerAction extends Action
 
     function showAjaxReviseForm()
     {
-        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');
-        $this->element('title', null, _m('Answer'));
+        // TRANS: Form title for sending an answer.
+        $this->element('title', null, _m('TITLE','Answer'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $form = new QnareviseanswerForm($this->answer, $this);
         $form->show();
         $this->elementEnd('body');
-        $this->elementEnd('html');
+        $this->endHTML();
     }
 
     /**
@@ -261,7 +256,7 @@ class QnareviseanswerAction 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') {