diff program/lib/Roundcube/rcube_utils.php @ 22:303b85d5b561

More cleaning up php8 Warnings/deprecations
author Charlie Root
date Wed, 15 Oct 2025 14:06:27 -0400
parents 73124dd49283
children
line wrap: on
line diff
--- a/program/lib/Roundcube/rcube_utils.php	Thu Oct 09 11:31:41 2025 -0400
+++ b/program/lib/Roundcube/rcube_utils.php	Wed Oct 15 14:06:27 2025 -0400
@@ -572,11 +572,12 @@
         // %d - domain name without first part
         $d = preg_replace('/^[^\.]+\./', '', $_SERVER['HTTP_HOST']);
         // %h - IMAP host
-        $h = $_SESSION['storage_host'] ?: $host;
+        $h = empty($_SESSION['storage_host']) ? $host : $_SESSION['storage_host'];
         // %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld
         $z = preg_replace('/^[^\.]+\./', '', $h);
         // %s - domain name after the '@' from e-mail address provided at login screen.
         //      Returns FALSE if an invalid email is provided
+	$s = '';
         if (strpos($name, '%s') !== false) {
             $user_email = self::get_input_value('_user', self::INPUT_POST);
             $user_email = self::idn_convert($user_email, true);
@@ -584,9 +585,10 @@
             if ($matches < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false) {
                 return false;
             }
+	    $s = $s[2];
         }
 
-        return str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s[2]), $name);
+        return str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s), $name);
     }
 
     /**