From cb38f40e9b6c307a2bc923068c37bb7e35d4d3ee Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 4 Oct 2024 09:56:01 +0200
Subject: [PATCH] update web files: Redirects and admin

---
 public_html/admin/index.php                  | 6 +++---
 public_html/admin/main.css                   | 2 +-
 public_html/classes/redirect.admin.class.php | 2 +-
 public_html/classes/redirect.class.php       | 4 ++--
 public_html/index.php                        | 5 ++---
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/public_html/admin/index.php b/public_html/admin/index.php
index 74c931c..f09c489 100644
--- a/public_html/admin/index.php
+++ b/public_html/admin/index.php
@@ -26,7 +26,7 @@ $aIco=[
     'h1'=>'⏩',
 
     'h2_head'=>'✔️',
-    'h2_err'=>'🔔',
+    'h2_err'=>'⚠️',
     'h2_config'=>'🛠️',
     'h2_file'=>'📄',
 
@@ -71,7 +71,7 @@ if (!$oR->isEnabled()){
     if ($sUrl){
         $sResult=$oR->httpGet($sUrl,1);
         echo '<h2>Response of a http HEAD request to '.$aIco['url'].' <a href="'.$sUrl.'">'.$sUrl.'</a></h2>'
-            . $oR->renderHttpResponseHeader($sResult, 1)
+            . $oR->renderHttpResponseHeader($sResult)
             ;
         return true;
     }
@@ -145,7 +145,7 @@ if (!$oR->isEnabled()){
                             .'<td class="type-'.$sType.'">'.$sType.'</td>'
                             .'<td class="type-'.$sType.'">'
                                 .($sType == 'direct' 
-                                    ? '<a href="?url=http://'.$sHost.'/'.$sFrom.'" title="click to test http://'.$sHost.'/'.$sFrom.'" onclick="showInOverlay(this); return false;">/'.$sFrom.'</a>' 
+                                    ? '<a href="?url=http://'.$sHost.$sFrom.'" title="click to test http://'.$sHost.'/'.$sFrom.'" onclick="showInOverlay(this); return false;">'.$sFrom.'</a>' 
                                     : $sFrom
                                 )
                             .'</td>'
diff --git a/public_html/admin/main.css b/public_html/admin/main.css
index 224eebe..7b23959 100644
--- a/public_html/admin/main.css
+++ b/public_html/admin/main.css
@@ -12,7 +12,7 @@ footer{background:rgba(0,0,0,0.03); margin-top: 4em; text-align: right;padding:
 
 .content{margin: 0 1em;}
 .legend{background: #fff; padding: 1em;}
-.error{background: #fcc; padding: 0.2em 1em;}
+.error{background: #fcc; padding: 0.2em 1.5em;}
 .warning{color:#651; background:#fec; padding: 0.2em 1em;}
 
 .cfgtype-alias{color:#89a;}
diff --git a/public_html/classes/redirect.admin.class.php b/public_html/classes/redirect.admin.class.php
index d11fbe0..9a1ed97 100644
--- a/public_html/classes/redirect.admin.class.php
+++ b/public_html/classes/redirect.admin.class.php
@@ -18,7 +18,7 @@ require_once 'redirect.class.php';
  * 2022-05-23  v1.6  ah  add http head check+render output; 
  * 2022-05-31  v1.7  ah  optical changes
  * 2023-08-28  v1.8  ah  remove php warning if there is no config yet
- * 2024-10-03  v1.9  ah  php8 only: typed variables
+ * 2024-10-04  v1.9  ah  php8 only: typed variables
  */
 
 /**
diff --git a/public_html/classes/redirect.class.php b/public_html/classes/redirect.class.php
index 49e85b8..ae8b2e9 100644
--- a/public_html/classes/redirect.class.php
+++ b/public_html/classes/redirect.class.php
@@ -24,7 +24,7 @@
  * 2020-05-06  v1.3  ah  added aliases for multiple domains with the same config
  * 2020-05-06  v1.4  ah  rewrite as class
  * 2023-08-28  v1.5  ah  fix loop over config with missing regex section.
- * 2024-10-03  v1.6  ah  php8 only: typed variables
+ * 2024-10-04  v1.6  ah  php8 only: typed variables
  */
 
 /**
@@ -55,7 +55,7 @@ class redirect
      * About message
      * @var string
      */
-    protected string $sAbout = 'IML redirect <small>v1.4</small>';
+    protected string $sAbout = 'IML redirect <small>v1.6</small>';
 
     /**
      * Hostname
diff --git a/public_html/index.php b/public_html/index.php
index 46ee307..2dcec2a 100755
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -17,9 +17,8 @@ require_once 'classes/redirect.class.php';
 
 $sHostname = $_SERVER['SERVER_NAME'];
 
-// find redirect ... the part between starting "/" to "?" or end of line
-$sRequest = preg_replace('#^(.*)\?.*$#', "$1", substr($_SERVER['REQUEST_URI'], 1));
-
+// find request ... the part between starting "/" to "?" or end of line
+$sRequest = preg_replace('#^(.*)\?.*$#', "$1", substr($_SERVER['REQUEST_URI'], 0));
 
 $oR=new redirect();
 $oR->setDebug(isset($_GET['debugredirect']) && $_GET['debugredirect'] ? true : false);
-- 
GitLab