]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/profilecompletion.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / profilecompletion.php
index 8208f3bd376614fda740d8a62706e85ef7206889..5880752fcf933faa069ad60a3b9761c4ef450a4e 100644 (file)
@@ -68,8 +68,7 @@ class ProfilecompletionAction extends Action
      *
      * @return boolean success flag
      */
-
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -78,9 +77,9 @@ class ProfilecompletionAction extends Action
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
+            // TRANS: Client error displayed when the session token does not match or is not given.
             $this->clientError(_('There was a problem with your session token.'.
                                  ' Try again, please.'));
-            return false;
         }
 
         // Only for logged-in users
@@ -88,22 +87,23 @@ class ProfilecompletionAction extends Action
         $this->user = common_current_user();
 
         if (empty($this->user)) {
+            // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
-            return false;
         }
 
         $id = $this->arg('peopletag_id');
-        $this->peopletag = Profile_list::staticGet('id', $id);
+        $this->peopletag = Profile_list::getKV('id', $id);
 
         if (empty($this->peopletag)) {
-            $this->clientError(_('No such peopletag.'));
-            return false;
+            // TRANS: Client error displayed trying to reference a non-existing list.
+            $this->clientError(_('No such list.'));
         }
 
         $field = $this->arg('field');
         if (!in_array($field, array('fulltext', 'nickname', 'fullname', 'description', 'location', 'uri'))) {
-            $this->clientError(sprintf(_('Unidentified field %s'), htmlspecialchars($field)), 404);
-            return false;
+            // TRANS: Client error displayed when trying to add an unindentified field to profile.
+            // TRANS: %s is a field name.
+            $this->clientError(sprintf(_('Unidentified field %s.'), htmlspecialchars($field)), 404);
         }
         $this->field = $field;
 
@@ -120,13 +120,14 @@ class ProfilecompletionAction extends Action
      * @return void
      */
 
-    function handle($args)
+    function handle(array $args=array())
     {
         $this->msg = null;
 
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
-        $this->element('title', null, _('Search results'));
+        // TRANS: Page title.
+        $this->element('title', null, _m('TITLE','Search results'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $profiles = $this->getResults();
@@ -141,11 +142,12 @@ class ProfilecompletionAction extends Action
                 }
                 $this->elementEnd('ul');
             } else {
+                // TRANS: Output when there are no results for a search.
                 $this->element('p', 'error', _('No results.'));
             }
         }
         $this->elementEnd('body');
-        $this->elementEnd('html');
+        $this->endHTML();
     }
 
     function getResults()
@@ -154,7 +156,8 @@ class ProfilecompletionAction extends Action
         $q = $this->arg('q');
         $q = strtolower($q);
         if (strlen($q) < 3) {
-            $this->msg = _('The search string must be atleast 3 characters long');
+            // TRANS: Error message in case a search is shorter than three characters.
+            $this->msg = _('The search string must be at least 3 characters long.');
         }
         $page = $this->arg('page');
         $page = (int) (empty($page) ? 1 : $page);
@@ -172,7 +175,7 @@ class ProfilecompletionAction extends Action
             else {
                 $cnt = $profile->find();
             }
-            Event::handle('EndProfileCompletionSearch', $this, &$profile, $search_engine);
+            Event::handle('EndProfileCompletionSearch', array($this, &$profile, $search_engine));
         }
 
         while ($profile->fetch()) {