Fixed XF301VB: Add redirects for external.php (patch included)

Steffen

Well-known member
I think it would be nice if XF301VB supported redirects for feed URLs. :)

This patch adds support for redirecting requests to URLs like "external.php?type=RSS2&forumids=123" to "forums/123/index.rss".

The "forumids" parameter accepted by vBulletin seems to support multiple IDs but such feeds don't seem to have an equivalent in XenForo and (at least on our site) aren't requested at all. I therefore chose to just pick the first ID.

Diff:
diff --git a/src/addons/XF301VB/Mvc/Router.php b/src/addons/XF301VB/Mvc/Router.php
index dcf13b595..8f247eac3 100644
--- a/src/addons/XF301VB/Mvc/Router.php
+++ b/src/addons/XF301VB/Mvc/Router.php
@@ -118,6 +118,26 @@ class Router extends \XF\Mvc\Router
                 break;
             }
 
+            // RSS-Feeds (Steffen)
+            case 'external.php':
+            {
+                $forum_ids = $request->filter('forumids', 'str');
+                $forum_id = (int) $forum_ids;
+
+                if ($forum_id)
+                {
+                    return $this->newRedirectRoute('forum-feed', [
+                        'forum_id' => $forum_id,
+                    ]);
+                }
+                else
+                {
+                    return $this->newRedirectRoute('simple-redirect', [
+                        'route_path' => 'forums/index.rss',
+                    ]);
+                }
+            }
+
             // vBulletin 3 and 4 non-rewrite URLs with STR IDs
             case 'tags.php':
             {
diff --git a/src/addons/XF301VB/Pub/Controller/Redirect.php b/src/addons/XF301VB/Pub/Controller/Redirect.php
index b097d841b..aac2c3199 100644
--- a/src/addons/XF301VB/Pub/Controller/Redirect.php
+++ b/src/addons/XF301VB/Pub/Controller/Redirect.php
@@ -20,6 +20,12 @@ class Redirect extends Controller
         return $this->redirectContent($params, 'node', 'XF:Node', 'forums', $oldId);
     }
 
+    public function actionForumFeed(ParameterBag $params)
+    {
+        $oldId = $params->forum_id;
+        return $this->redirectContent($params, 'node', 'XF:Node', 'forums/index.rss', $oldId);
+    }
+
     public function actionThread(ParameterBag $params)
     {
         if ($postId = $this->filter('p', 'int'))
 
Last edited:
Top