]> 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 862d4c762be688b2d2d4cf9f143e12ab0945d87a..ebb5022b9910f6e1c89d528a620d461ae3bdc3cc 100644 (file)
@@ -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 {
@@ -680,7 +677,7 @@ class Notice extends Memcached_DataObject
             return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null);
         }
 
-        # Get the cache; if we cannot, just go to the DB
+        # Get the cache; if we can't, just go to the DB
 
         $cache = common_memcache();
 
@@ -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();
@@ -1364,7 +1367,7 @@ class Notice extends Memcached_DataObject
             }
         }
 
-        // If it's not a "low bandwidth" source (one where you cannot set
+        // If it's not a "low bandwidth" source (one where you can't set
         // a reply_to argument), we return. This is mostly web and API
         // clients.