]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/profilesettings.php
Merge remote-tracking branch 'mainline/1.0.x' into people_tags_rebase
[quix0rs-gnu-social.git] / actions / profilesettings.php
index 8ce119257908821ff0b5cf160e792389391e1b8b..1961f94e9ffb73cd20ad40ffbd1fd2d6ca6ad468 100644 (file)
@@ -290,18 +290,24 @@ class ProfilesettingsAction extends SettingsAction
                 return;
             }
 
-            if ($tagstring) {
-                $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
-            } else {
-                $tags = array();
-            }
+            $tags = array();
+            $tag_priv = array();
+            if (is_string($tagstring) && strlen($tagstring) > 0) {
 
-            foreach ($tags as $tag) {
-                if (!common_valid_profile_tag($tag)) {
-                    // TRANS: Validation error in form for profile settings.
-                    // TRANS: %s is an invalid tag.
-                    $this->showForm(sprintf(_('Invalid tag: "%s".'), $tag));
-                    return;
+                $tags = preg_split('/[\s,]+/', $tagstring);
+
+                foreach ($tags as &$tag) {
+                    $private = @$tag[0] === '.';
+
+                    $tag = common_canonical_tag($tag);
+                    if (!common_valid_profile_tag($tag)) {
+                        // TRANS: Validation error in form for profile settings.
+                        // TRANS: %s is an invalid tag.
+                        $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
+                        return;
+                    }
+
+                    $tag_priv[$tag] = $private;
                 }
             }
 
@@ -433,7 +439,7 @@ class ProfilesettingsAction extends SettingsAction
             }
 
             // Set the user tags
-            $result = $user->setSelfTags($tags);
+            $result = $user->setSelfTags($tags, $tag_priv);
 
             if (!$result) {
                 // TRANS: Server error thrown when user profile settings tags could not be saved.