]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
first pass at Mapstraction plugin
[quix0rs-gnu-social.git] / classes / Notice.php
index 32a8b693c02accda14ffcf50f21259f1da71c1d4..ebb5022b9910f6e1c89d528a620d461ae3bdc3cc 100644 (file)
@@ -146,7 +146,7 @@ class Notice extends Memcached_DataObject
 
         /* Add them to the database */
         foreach(array_unique($hashtags) as $hashtag) {
-            /* elide characters we do not want in the tag */
+            /* elide characters we don't want in the tag */
             $this->saveTag($hashtag);
         }
         return true;
@@ -195,22 +195,19 @@ class Notice extends Memcached_DataObject
                                         ' take a breather and post again in a few minutes.'));
         }
 
-        $banned = common_config('profile', 'banned');
-
-        if ( in_array($profile_id, $banned) || in_array($profile->nickname, $banned)) {
-            common_log(LOG_WARNING, "Attempted post from banned user: $profile->nickname (user id = $profile_id).");
+        if (!$profile->hasRight(Right::NEWNOTICE)) {
+            common_log(LOG_WARNING, "Attempted post from user disallowed to post: " . $profile->nickname);
             throw new ClientException(_('You are banned from posting notices on this site.'));
         }
 
         $notice = new Notice();
         $notice->profile_id = $profile_id;
 
-        $blacklist = common_config('public', 'blacklist');
         $autosource = common_config('public', 'autosource');
 
-        # Blacklisted are non-false, but not 1, either
+        # Sandboxed are non-false, but not 1, either
 
-        if (($blacklist && in_array($profile_id, $blacklist)) ||
+        if (!$profile->hasRight(Right::PUBLICNOTICE) ||
             ($source && $autosource && in_array($source, $autosource))) {
             $notice->is_local = Notice::LOCAL_NONPUBLIC;
         } else {
@@ -1105,7 +1102,7 @@ class Notice extends Memcached_DataObject
             if (empty($recipient)) {
                 continue;
             }
-            // Do not save replies from blocked profile to local user
+            // Don't save replies from blocked profile to local user
             $recipient_user = User::staticGet('id', $recipient->id);
             if (!empty($recipient_user) && $recipient_user->hasBlocked($sender)) {
                 continue;
@@ -1131,7 +1128,7 @@ class Notice extends Memcached_DataObject
                 $tagged = Profile_tag::getTagged($sender->id, $tag);
                 foreach ($tagged as $t) {
                     if (!$replied[$t->id]) {
-                        // Do not save replies from blocked profile to local user
+                        // Don't save replies from blocked profile to local user
                         $t_user = User::staticGet('id', $t->id);
                         if ($t_user && $t_user->hasBlocked($sender)) {
                             continue;
@@ -1254,6 +1251,12 @@ class Notice extends Memcached_DataObject
             }
         }
 
+        if (!empty($this->lat) && !empty($this->lon)) {
+            $xs->elementStart('geo', array('xmlns:georss' => 'http://www.georss.org/georss'));
+            $xs->element('georss:point', null, $this->lat . ' ' . $this->lon);
+            $xs->elementEnd('geo');
+        }
+
         $xs->elementEnd('entry');
 
         return $xs->getString();