git subrepo commit (merge) mailcow/src/mailcow-dockerized

subrepo:
  subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "81fb18894"
upstream:
  origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "4ca02ecee"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"

Update to upstream 2026-10.  Local patches re-applied by hand
(no Unbound DNS for containers, IPv6 off by default, fake-MySQL
stubs in dockerapi, Postfix overrides, no .env symlink); dropped
the unused dovecot and clamd Dockerfile patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I2c2c194d1d436b841358685f5f94aef09eb19ae8
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php b/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
index b729235..49a098e 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
@@ -3,7 +3,7 @@
 	global $redis;

 	global $lang;

   global $LOGO_LIMITS;

-  

+

   switch ($_action) {

     case 'add':

       // disable functionality when demo mode is enabled

@@ -122,10 +122,16 @@
         case 'app_links':

           $apps = (array)$_data['app'];

           $links = (array)$_data['href'];

+          $user_links = (array)$_data['user_href'];

+          $hide = (array)$_data['hide'];

           $out = array();

-          if (count($apps) == count($links)) {

+          if (count($apps) == count($links) && count($apps) == count($user_links) && count($apps) == count($hide)) {

             for ($i = 0; $i < count($apps); $i++) {

-              $out[] = array($apps[$i] => $links[$i]);

+              $out[] = array($apps[$i] => array(

+                'link' => $links[$i],

+                'user_link' => $user_links[$i],

+                'hide' => ($hide[$i] === '0' || $hide[$i] === 0) ? false : true

+              ));

             }

             try {

               $redis->set('APP_LINKS', json_encode($out));

@@ -198,6 +204,67 @@
             'msg' => 'ip_check_opt_in_modified'

           );

         break;

+        case 'custom_login':

+          $hide_user_quicklink        = ($_data['hide_user_quicklink'] == "1") ? 1 : 0;

+          $hide_domainadmin_quicklink = ($_data['hide_domainadmin_quicklink'] == "1") ? 1 : 0;

+          $hide_admin_quicklink       = ($_data['hide_admin_quicklink'] == "1") ? 1 : 0;

+          $force_sso                  = ($_data['force_sso'] == "1") ? 1 : 0;

+

+          $custom_login = array(

+            "hide_user_quicklink" => $hide_user_quicklink,

+            "hide_domainadmin_quicklink" => $hide_domainadmin_quicklink,

+            "hide_admin_quicklink" => $hide_admin_quicklink,

+            "force_sso" => $force_sso,

+          );

+          try {

+            $redis->set('CUSTOM_LOGIN', json_encode($custom_login));

+          }

+          catch (RedisException $e) {

+            $_SESSION['return'][] = array(

+              'type' => 'danger',

+              'log' => array(__FUNCTION__, $_action, $_item, $_data),

+              'msg' => array('redis_error', $e)

+            );

+            return false;

+          }

+          $_SESSION['return'][] = array(

+            'type' => 'success',

+            'log' => array(__FUNCTION__, $_action, $_item, $_data),

+            'msg' => 'custom_login_modified'

+          );

+        break;

+        case 'ui_theme':

+          $ui_theme = is_array($_data['ui_theme']) ? (string)reset($_data['ui_theme']) : (string)$_data['ui_theme'];

+          if ($ui_theme !== '' && !array_key_exists($ui_theme, customize('get', 'ui_themes'))) {

+            $_SESSION['return'][] = array(

+              'type' => 'danger',

+              'log' => array(__FUNCTION__, $_action, $_item, $_data),

+              'msg' => 'ui_theme_invalid'

+            );

+            return false;

+          }

+          try {

+            if ($ui_theme === '') {

+              $redis->del('UI_THEME');

+            }

+            else {

+              $redis->set('UI_THEME', $ui_theme);

+            }

+          }

+          catch (RedisException $e) {

+            $_SESSION['return'][] = array(

+              'type' => 'danger',

+              'log' => array(__FUNCTION__, $_action, $_item, $_data),

+              'msg' => array('redis_error', $e)

+            );

+            return false;

+          }

+          $_SESSION['return'][] = array(

+            'type' => 'success',

+            'log' => array(__FUNCTION__, $_action, $_item, $_data),

+            'msg' => 'ui_theme_modified'

+          );

+        break;

       }

     break;

     case 'delete':

@@ -256,7 +323,23 @@
             );

             return false;

           }

-          return ($app_links) ? $app_links : false;

+

+          if (empty($app_links)){

+            return [];

+          }

+

+          // convert from old style

+          foreach($app_links as $i => $entry){

+            foreach($entry as $app => $link){

+              if (empty($link['link']) && empty($link['user_link'])){

+                $app_links[$i][$app] = array();

+                $app_links[$i][$app]['link'] = $link;

+                $app_links[$i][$app]['user_link'] = $link;

+              }

+            }

+          }

+

+          return $app_links;

         break;

         case 'main_logo':

         case 'main_logo_dark':

@@ -274,8 +357,10 @@
         break;

         case 'ui_texts':

           try {

-            $data['title_name'] = ($title_name = $redis->get('TITLE_NAME')) ? $title_name : 'mailcow UI';

-            $data['main_name'] = ($main_name = $redis->get('MAIN_NAME')) ? $main_name : 'mailcow UI';

+            $mailcow_hostname = strtolower(getenv("MAILCOW_HOSTNAME"));

+

+            $data['title_name'] = ($title_name = $redis->get('TITLE_NAME')) ? $title_name : "$mailcow_hostname - mail UI";

+            $data['main_name'] = ($main_name = $redis->get('MAIN_NAME')) ? $main_name : "$mailcow_hostname - mail UI";

             $data['apps_name'] = ($apps_name = $redis->get('APPS_NAME')) ? $apps_name : $lang['header']['apps'];

             $data['help_text'] = ($help_text = $redis->get('HELP_TEXT')) ? $help_text : false;

             if (!empty($redis->get('UI_IMPRESS'))) {

@@ -335,6 +420,56 @@
             return false;

           }

         break;

+        case 'custom_login':

+          try {

+            $custom_login = $redis->get('CUSTOM_LOGIN');

+            return $custom_login ? json_decode($custom_login, true) : array();

+          }

+          catch (RedisException $e) {

+            $_SESSION['return'][] = array(

+              'type' => 'danger',

+              'log' => array(__FUNCTION__, $_action, $_item, $_data),

+              'msg' => array('redis_error', $e)

+            );

+            return false;

+          }

+        break;

+        case 'ui_themes':

+          // theme folders in css/themes/<name>/ with a theme.css

+          $themes = array();

+          foreach (glob('/web/css/themes/*/theme.css') as $theme_css) {

+            $theme_dir = dirname($theme_css);

+            $theme = basename($theme_dir);

+            if (!preg_match('/^[a-zA-Z0-9_-]+$/', $theme)) {

+              continue;

+            }

+            $meta = json_decode(@file_get_contents($theme_dir . '/theme.json'), true);

+            $themes[$theme] = array(

+              'name' => (!empty($meta['name'])) ? $meta['name'] : $theme,

+              'description' => (!empty($meta['description'])) ? $meta['description'] : '',

+              'dark' => file_exists($theme_dir . '/dark.css')

+            );

+          }

+          ksort($themes);

+          return $themes;

+        break;

+        case 'ui_theme':

+          try {

+            $ui_theme = $redis->get('UI_THEME');

+          }

+          catch (RedisException $e) {

+            $_SESSION['return'][] = array(

+              'type' => 'danger',

+              'log' => array(__FUNCTION__, $_action, $_item, $_data),

+              'msg' => array('redis_error', $e)

+            );

+            return false;

+          }

+          if (empty($ui_theme) || !preg_match('/^[a-zA-Z0-9_-]+$/', $ui_theme) || !file_exists('/web/css/themes/' . $ui_theme . '/theme.css')) {

+            return '';

+          }

+          return $ui_theme;

+        break;

       }

     break;

   }