]> 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 c08a66790fe18698550f34374fe3181c8e538df2..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 {
@@ -930,7 +927,10 @@ class Notice extends Memcached_DataObject
             $users = $group->getUserMembers();
             foreach ($users as $id) {
                 if (!array_key_exists($id, $ni)) {
-                    $ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
+                    $user = User::staticGet('id', $id);
+                    if (!$user->hasBlocked($notice->profile_id)) {
+                        $ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
+                    }
                 }
             }
         }
@@ -1181,10 +1181,9 @@ class Notice extends Memcached_DataObject
             $xs->element('link', array('href' => $profile->profileurl));
             $user = User::staticGet('id', $profile->id);
             if (!empty($user)) {
-                $atom_feed = common_local_url('api',
-                                              array('apiaction' => 'statuses',
-                                                    'method' => 'user_timeline',
-                                                    'argument' => $profile->nickname.'.atom'));
+                $atom_feed = common_local_url('ApiTimelineUser',
+                                              array('format' => 'atom',
+                                                    'id' => $profile->nickname));
                 $xs->element('link', array('rel' => 'self',
                                            'type' => 'application/atom+xml',
                                            'href' => $profile->profileurl));
@@ -1252,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();