]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Don't trust local HTML either
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 7db385b1a9a94e8b439532955e4fcb4c9665a512..7c509f06418900d30bc9059ac15080f2f73e7c75 100644 (file)
@@ -444,6 +444,17 @@ class OStatusPlugin extends Plugin
         return null;
     }
 
+    function onEndProfileSettingsActions($out) {
+        $siteName = common_config('site', 'name');
+        $js = 'navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "'.addslashes(common_local_url('ostatussub', null, array('profile' => '%s'))).'", "'.addslashes($siteName).'")';
+        $out->elementStart('li');
+        $out->element('a',
+                      array('href' => 'javascript:'.$js),
+                      // TRANS: Option in profile settings to add this instance to Firefox as a feedreader
+                      _('Add to Firefox as feedreader'));
+        $out->elementEnd('li');
+    }
+
     /**
      * Make sure necessary tables are filled out.
      */
@@ -1254,17 +1265,23 @@ class OStatusPlugin extends Plugin
     function onStartGetProfileFromURI($uri, &$profile)
     {
         // Don't want to do Web-based discovery on our own server,
-        // so we check locally first.
+        // so we check locally first. This duplicates the functionality
+        // in the Profile class, since the plugin always runs before
+        // that local lookup, but since we return false it won't run double.
 
         $user = User::getKV('uri', $uri);
-
-        if (!empty($user)) {
+        if ($user instanceof User) {
             $profile = $user->getProfile();
             return false;
+        } else {
+            $group = User_group::getKV('uri', $uri);
+            if ($group instanceof User_group) {
+                $profile = $group->getProfile();
+                return false;
+            }
         }
 
         // Now, check remotely
-
         try {
             $oprofile = Ostatus_profile::ensureProfileURI($uri);
             $profile = $oprofile->localProfile();