From 3bbf945a7f25adfeb2f318974c75ce65f441ec1b Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Tue, 8 Feb 2022 11:48:46 +0100
Subject: [PATCH] ignore EXTERNAL_HELP_LOCATIONID and use only major version,
 fixes #654

---
 lib/functions.php | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/lib/functions.php b/lib/functions.php
index 8a0e4036cfb..96dd9551731 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -1005,29 +1005,18 @@ function search_range($search_str = false, $search_user = false, $show_sem = tru
  */
 function format_help_url($keyword)
 {
-    $helppage = $keyword;
-
-    // $loc is only set if special help view for installation is known
-    $loc = "";
-
-    $locationid = Config::get()->EXTERNAL_HELP_LOCATIONID;
-    if ($locationid && $locationid !== 'default') {
-        $loc = $locationid . '/';
-    }
-
     // all help urls need short language tag (de, en)
     $lang = 'de';
     if ($_SESSION['_language']) {
         [$lang] = explode('_', $_SESSION['_language']);
     }
 
-    // determine Stud.IP version as of MAJOR.MINOR
-    // from SOFTWARE_VERSION. That variable MUST match pattern MAJOR.MINOR.*
-    preg_match('/^(\d+\.\d+)/', $GLOBALS['SOFTWARE_VERSION'], $v);
+    // determine major Stud.IP version from SOFTWARE_VERSION.
+    preg_match('/^\d+/', $GLOBALS['SOFTWARE_VERSION'], $v);
     $version = $v[0];
 
-    $help_query = sprintf('https://hilfe.studip.de/help/%s/%s/%s%s',
-                          $version, $lang, $loc, $helppage);
+    $help_query = sprintf('https://hilfe.studip.de/help/%s.0/%s/%s',
+                          $version, $lang, $keyword);
     return $help_query;
 }
 
-- 
GitLab