]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/actions/qnaclosequestion.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / QnA / actions / qnaclosequestion.php
index 28d4e547b455f5fb26ed756f1921393934eb0fb0..2cafde91fc9f14939917010305a5eb43ed18b15a 100644 (file)
@@ -74,14 +74,14 @@ class QnaclosequestionAction 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 close a question when not logged in
             throw new ClientException(
+                // TRANS: Client exception thrown trying to close a question when not logged in
                 _m("You must be logged in to close a question."),
                 403
             );
@@ -92,7 +92,7 @@ class QnaclosequestionAction extends Action
         }
 
         $id = substr($this->trimmed('id'), 9);
-        $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);
@@ -128,19 +128,18 @@ class QnaclosequestionAction extends Action
      */
     function closeQuestion()
     {
-
         $user = common_current_user();
 
         try {
-
             if ($user->id != $this->question->profile_id) {
-                throw new Exception(_m('You didn\'t ask this question.'));
+                // TRANS: Exception thrown trying to close another user's question.
+                throw new Exception(_m('You did not ask this question.'));
             }
 
             $orig = clone($this->question);
             $this->question->closed = 1;
             $this->question->update($orig);
-            
+
         } catch (ClientException $ce) {
             $this->error = $ce->getMessage();
             $this->showPage();
@@ -148,9 +147,7 @@ class QnaclosequestionAction 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.
             $this->element('title', null, _m('Answers'));
@@ -159,9 +156,9 @@ class QnaclosequestionAction extends Action
             $form = new QnashowquestionForm($this, $this->question);
             $form->show();
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
-            common_redirect($this->question->bestUrl(), 303);
+            common_redirect($this->question->getUrl(), 303);
         }
     }
 
@@ -188,7 +185,7 @@ class QnaclosequestionAction 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') {