[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

"Jean-Marc Kadimba \(@jmkadimba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69d4b24ca932b_3b1943bc28665@gitlab-sidekiq-low-urgency-cpu-bound-v2-55d7689f86-cfmsf.mail>

Jean-Marc Kadimba pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
e0f917ff by Jean-Marc Kadimba at 2026-04-07T09:21:56+02:00
[NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
---
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
---
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
---
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

* Fix pipeline

* Fix pipeline

* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

See merge request tikiwiki/tiki!9901

(cherry picked from commit 616e91b6c090bc838f23cfee9f87ae28beeb8e33)

1564711c [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
09258de2 Fix pipeline
c645880e Fix pipeline
efd86ded [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
9f8c472b [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
562b4380 [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
1edc4329 [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.

Co-authored-by: Jean-Marc Kadimba <[email protected]>

See merge request tikiwiki/tiki!9959

See merge request tikiwiki/tiki!9960

- - - - -


6 changed files:

- + lib/prefs/rssproxy.php
- lib/prefs/use.php
- lib/rss/rsslib.php
- lib/setup/prefs.php
- lib/tikilib.php
- templates/admin/include_general.tpl


Changes:

=====================================
lib/prefs/rssproxy.php
=====================================
@@ -0,0 +1,47 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+function prefs_rssproxy_list()
+{
+    return  [
+        'rssproxy_host' => [
+            'name' => tra('Proxy host name'),
+            'description' => tra('Proxy host - without http:// or similar, just the host name'),
+            'type' => 'text',
+            'size' => '20',
+            'filter' => 'url',
+            'dependencies' => [
+                'use_rss_proxy',
+            ],
+            'default' => '',
+        ],
+        'rssproxy_port' => [
+            'name' => tra('Port'),
+            'description' => tra('Proxy port'),
+            'type' => 'text',
+            'filter' => 'digits',
+            'size' => '5',
+            'dependencies' => [
+                'use_rss_proxy',
+            ],
+            'default' => '',
+        ],
+        'rssproxy_user' => [
+            'name' => tra('Proxy username'),
+            'type' => 'text',
+            'size' => 10,
+            'filter' => 'none',
+            'default' => '',
+        ],
+        'rssproxy_pass' => [
+            'name' => tra('Proxy password'),
+            'type' => 'text',
+            'size' => 10,
+            'filter' => 'none',
+            'default' => '',
+        ],
+    ];
+}


=====================================
lib/prefs/use.php
=====================================
@@ -22,6 +22,13 @@ function prefs_use_list()
             'perspective' => false,
             'default' => 'n',
         ],
+        'use_rss_proxy' => [
+            'name' => tra('Use RSS proxy'),
+            'description' => tra('Specify if external feeds requires a proxy to access the internet. If enabled, the proxy Host name (either with or without the http:// prefix), Port settings, Username, and Password can be specified.'),
+            'type' => 'flag',
+            'perspective' => false,
+            'default' => 'n',
+        ],
 
         // FIXME: These 2 have misleading names. Actions will use context menus even if (only) one is disabled. Do we really need to have 2 preferences for this? Surely if we have context menus they should have both icons and text. Chealer 2017-07-03
         'use_context_menu_icon' => [


=====================================
lib/rss/rsslib.php
=====================================
@@ -1055,9 +1055,14 @@ class RSSLib extends TikiDb_Bridge
 
     private function fetchFeed(string $url)
     {
-        global $tikilib;
+        global $tikilib, $prefs;
         try {
-            $content = $tikilib->httprequest($url);
+            if (isset($prefs['use_rss_proxy']) && $prefs['use_rss_proxy'] == 'y') {
+                $content = $tikilib->httprequest($url, useRssProxy: true);
+            } else {
+                $content = $tikilib->httprequest($url);
+            }
+
             if ($content) {
                 return Laminas\Feed\Reader\Reader::importString($content);
             }


=====================================
lib/setup/prefs.php
=====================================
@@ -194,6 +194,7 @@ function get_default_prefs()
             'shoutbox_autolink' => 'n',
             'show_comzone' => 'n',
             'use_proxy' => 'n',
+            'use_rss_proxy' => 'n',
             'webserverauth' => 'n',
 
             'feature_intertiki_imported_groups' => '',


=====================================
lib/tikilib.php
=====================================
@@ -221,7 +221,7 @@ class TikiLib extends TikiDb_Bridge
      * @param array $options
      * @return mixed|Laminas\Http\Client
      */
-    public function get_http_client($url = false, $options = null, $user = null)
+    public function get_http_client($url = false, $options = null, $user = null, $useRssProxy = false)
     {
         global $prefs;
 
@@ -244,6 +244,17 @@ class TikiLib extends TikiDb_Bridge
             $config['adapter'] = 'Laminas\Http\Client\Adapter\Curl';
         }
 
+        if ($useRssProxy) {
+            $config['adapter'] = 'Laminas\Http\Client\Adapter\Proxy';
+            $config["proxy_host"] = $prefs['rssproxy_host'];
+            $config["proxy_port"] = $prefs['rssproxy_port'];
+
+            if ($prefs['rssproxy_user'] || $prefs['rssproxy_pass']) {
+                $config["proxy_user"] = $prefs['rssproxy_user'];
+                $config["proxy_pass"] = $prefs['rssproxy_pass'];
+            }
+        }
+
         if ($prefs['zend_http_sslverifypeer'] == 'y') {
             $config['sslverifypeer'] = true;
         } else {
@@ -491,7 +502,7 @@ class TikiLib extends TikiDb_Bridge
      * @param string $reqmethod
      * @return bool
      */
-    public function httprequest($url, $reqmethod = "GET")
+    public function httprequest($url, $reqmethod = "GET", $useRssProxy = false)
     {
         // test url :
         // rewrite url if sloppy # added a case for https urls
@@ -503,7 +514,7 @@ class TikiLib extends TikiDb_Bridge
         }
 
         try {
-            $client = $this->get_http_client($url);
+            $client = $this->get_http_client($url, useRssProxy: $useRssProxy);
             /* @var $response Laminas\Http\Response */
             $response = $this->http_perform_request($client);
 


=====================================
templates/admin/include_general.tpl
=====================================
@@ -181,6 +181,13 @@
                     {preference name=proxy_user}
                     {preference name=proxy_pass}
                 </div>
+                {preference name=use_rss_proxy}
+                <div class="adminoptionboxchild" id="use_rss_proxy_childcontainer">
+                    {preference name=rssproxy_host}
+                    {preference name=rssproxy_port}
+                    {preference name=rssproxy_user}
+                    {preference name=rssproxy_pass}
+                </div>
                 {preference name=http_skip_frameset}
                 {preference name=feature_loadbalancer}
                 {preference name=feature_port_rewriting}



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e0f917ffbf73d6d9ec8f0f7741b8e9e75fd2b205

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e0f917ffbf73d6d9ec8f0f7741b8e9e75fd2b205
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.