]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Poll/newpoll.php
Merge branch '1.1.x'
[quix0rs-gnu-social.git] / plugins / Poll / newpoll.php
index 585af1a7b52a13587173d699eb75f293e0fc6898..e7d5d3dd0d6d32484d7b9cb9e4f83cada24bb1c0 100644 (file)
@@ -59,7 +59,8 @@ class NewPollAction extends Action
      */
     function title()
     {
-        return _('New poll');
+        // TRANS: Title for poll page.
+        return _m('New poll');
     }
 
     /**
@@ -76,7 +77,8 @@ class NewPollAction extends Action
         $this->user = common_current_user();
 
         if (empty($this->user)) {
-            throw new ClientException(_("You must be logged in to post a poll."),
+            // TRANS: Client exception thrown trying to create a poll while not logged in.
+            throw new ClientException(_m('You must be logged in to post a poll.'),
                                       403);
         }
 
@@ -127,17 +129,28 @@ class NewPollAction extends Action
         }
         try {
             if (empty($this->question)) {
-                throw new ClientException(_('Poll must have a question.'));
+            // TRANS: Client exception thrown trying to create a poll without a question.
+                throw new ClientException(_m('Poll must have a question.'));
             }
 
             if (count($this->options) < 2) {
-                throw new ClientException(_('Poll must have at least two options.'));
+                // TRANS: Client exception thrown trying to create a poll with fewer than two options.
+                throw new ClientException(_m('Poll must have at least two options.'));
             }
 
+            // Notice options; distinct from choices for the poll
+
+            $options = array();
+
+            // Does the heavy-lifting for getting "To:" information
+
+            ToSelector::fillOptions($this, $options);
 
             $saved = Poll::saveNew($this->user->getProfile(),
-                                              $this->question,
-                                              $this->options);
+                                   $this->question,
+                                   $this->options,
+                                   $options);
+
         } catch (ClientException $ce) {
             $this->error = $ce->getMessage();
             $this->showPage();
@@ -150,7 +163,7 @@ class NewPollAction extends Action
             $this->elementStart('html');
             $this->elementStart('head');
             // TRANS: Page title after sending a notice.
-            $this->element('title', null, _('Notice posted'));
+            $this->element('title', null, _m('Notice posted'));
             $this->elementEnd('head');
             $this->elementStart('body');
             $this->showNotice($saved);