Description: use shared php and js libraries
 Use shared php and js libraries shipped with Debian, instead of embedded
 libraries that come with the upstream source.
Forwarded: not-needed
Last-Update: 2024-11-30
Author: Jing Luo <jing@jing.rocks>

---
 config.inc.php           |    2 +-
 model/PFASmarty.php      |    6 +++---
 public/css/bootstrap.css |    4 ++--
 public/setup.php         |    4 ++--
 templates/header.tpl     |    8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/config.inc.php b/config.inc.php
index 118d4171..09b8e184 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -692,7 +692,7 @@ $CONF['theme'] = 'default';
 // Specify your own favicon, logo and CSS file
 $CONF['theme_favicon'] = 'images/favicon.ico';
 $CONF['theme_logo'] = 'images/logo-default.png';
-$CONF['theme_css'] = 'css/bootstrap.css';
+$CONF['theme_css'] = 'static/bootstrap.css';
 // If you want to customize some styles without editing the $CONF['theme_css'] file,
 // you can add a custom CSS file. It will be included after $CONF['theme_css'].
 $CONF['theme_custom_css'] = '';
diff --git a/model/PFASmarty.php b/model/PFASmarty.php
index e6ac626b..91dee4c7 100644
--- a/model/PFASmarty.php
+++ b/model/PFASmarty.php
@@ -60,10 +60,10 @@ class PFASmarty {
         $CONF = Config::getInstance()->getAll();
 
         // see: https://github.com/postfixadmin/postfixadmin/issues/410
-        // ignore $CONF['theme_css'] if it points to css/default.css and we have css/bootstrap.css.
-        if ($CONF['theme_css'] == 'css/default.css' && is_file(__DIR__ . '/../public/css/bootstrap.css')) {
+        // ignore $CONF['theme_css'] if it points to css/default.css and we have static/bootstrap.css.
+        if ($CONF['theme_css'] == 'css/default.css' && is_file(__DIR__ . '/../public/static/bootstrap.css')) {
             // silently upgrade to bootstrap, css/default.css does not exist.
-            $CONF['theme_css'] = 'css/bootstrap.css';
+            $CONF['theme_css'] = 'static/bootstrap.css';
         }
 
         $CONF['theme_css'] = $rel_path . htmlentities($CONF['theme_css']);
diff --git a/public/css/bootstrap.css b/public/css/bootstrap.css
index 86b790c4..40b27957 100644
--- a/public/css/bootstrap.css
+++ b/public/css/bootstrap.css
@@ -1,5 +1,5 @@
-@import url(bootstrap-3.4.1-dist/css/bootstrap.min.css);
-@import url(bootstrap-3.4.1-dist/css/bootstrap-datetimepicker.min.css);
+@import url(bootstrap/css/bootstrap.min.css);
+@import url(bootstrap-datetimepicker/bootstrap-datetimepicker.min.css);
 /* Sticky footer styles
 -------------------------------------------------- */
 html {
diff --git a/public/setup.php b/public/setup.php
index 4f051fdc..7affbce5 100644
--- a/public/setup.php
+++ b/public/setup.php
@@ -11,8 +11,8 @@ require_once('common.php');
 
     <title>Postfix Admin - Setup</title>
     <link rel="shortcut icon" href="images/favicon.ico"/>
-    <link rel="stylesheet" href="css/bootstrap-3.4.1-dist/css/bootstrap.min.css"/>
-    <link rel="stylesheet" href="css/bootstrap.css"/>
+    <link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css"/>
+    <link rel="stylesheet" href="static/bootstrap.css"/>
 
 </head>
 
diff --git a/templates/header.tpl b/templates/header.tpl
index 99d9aad1..45aa9408 100644
--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -14,9 +14,9 @@
     {/if}
 
     <!-- needed for datetimepicker -->
-    <script src="{$rel_path}jquery-3.7.0.min.js"></script>
-    <script src="{$rel_path}css/bootstrap-3.4.1-dist/js/moment-with-locales.min.js"></script>
-    <script src="{$rel_path}css/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
-    <script src="{$rel_path}css/bootstrap-3.4.1-dist/js/bootstrap-datetimepicker.min.js"></script>
+    <script src="{$rel_path}static/jquery/jquery.min.js"></script>
+    <script src="{$rel_path}static/moment/moment-with-locales.min.js"></script>
+    <script src="{$rel_path}static/bootstrap/js/bootstrap.min.js"></script>
+    <script src="{$rel_path}static/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
 </head>
 <body class="lang-{if isset($smarty.session.lang)}{$smarty.session.lang}{/if} page-{$smarty_template} {if isset($table)}page-{$smarty_template}-{$table}{/if}">
