]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/toselector.php
Merge branch 'nightly' into 'nightly'
[quix0rs-gnu-social.git] / lib / toselector.php
index f29451ad9372eb0049f74b2343e2bb4259fb4b6b..7a959ff8b518e9e48ba23d997fbc651a3294803f 100644 (file)
@@ -80,16 +80,7 @@ class ToSelector extends Widget
     function show()
     {
         $choices = array();
-        $default = 'public:site';
-
-        if (!common_config('site', 'private')) {
-            // TRANS: Option in drop-down of potential addressees.
-            $choices['public:everyone'] = _m('SENDTO','Everyone');
-            $default = 'public:everyone';
-        }
-        // TRANS: Option in drop-down of potential addressees.
-        // TRANS: %s is a StatusNet sitename.
-        $choices['public:site'] = sprintf(_('Everyone at %s'), common_config('site', 'name'));
+        $default = common_config('site', 'private') ? 'public:site' : 'public:everyone';
 
         $groups = $this->user->getGroups();
 
@@ -108,7 +99,7 @@ class ToSelector extends Widget
             try {
                 $choices[$value] = substr($users->getAcctUri(), 5) . " [{$users->getBestName()}]";
             } catch (ProfileNoAcctUriException $e) {
-                $choices[$value] = "[?@?] " . $e->getBestName();
+                $choices[$value] = "[?@?] " . $e->profile->getBestName();
             }
         }
 
@@ -118,13 +109,30 @@ class ToSelector extends Widget
             try {
                 $choices[$value] = substr($this->to->getAcctUri(), 5) . " [{$this->to->getBestName()}]";
             } catch (ProfileNoAcctUriException $e) {
-                $choices[$value] = "[?@?] " . $e->getBestName();
+                $choices[$value] = "[?@?] " . $e->profile->getBestName();
             }
         }
 
         // alphabetical order
         asort($choices);
 
+        // Reverse so we can add entries at the end (can't unshift with a key)
+        $choices = array_reverse($choices);
+
+        if (common_config('notice', 'allowprivate')) {
+            // TRANS: Option in drop-down of potential addressees.
+            // TRANS: %s is a StatusNet sitename.
+            $choices['public:site'] = sprintf(_('Everyone at %s'), common_config('site', 'name'));
+        }
+
+        if (!common_config('site', 'private')) {
+            // TRANS: Option in drop-down of potential addressees.
+            $choices['public:everyone'] = _m('SENDTO','Everyone');
+        }
+
+        // Return the order
+        $choices = array_reverse($choices);
+
         $this->out->dropdown($this->id,
                              // TRANS: Label for drop-down of potential addressees.
                              _m('LABEL','To:'),