Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | <?php |
| 2 | |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 3 | // check for development mode |
| 4 | $DEV_MODE = (getenv('DEV_MODE') == 'y'); |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 5 | // check for demo mode |
| 6 | $DEMO_MODE = (getenv('DEMO_MODE') == 'y'); |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 7 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 8 | // Slave does not serve UI |
| 9 | /* if (!preg_match('/y|yes/i', getenv('MASTER'))) { |
| 10 | header('Location: /SOGo', true, 307); |
| 11 | exit; |
| 12 | }*/ |
| 13 | |
| 14 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.inc.php'; |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 15 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 16 | $default_autodiscover_config = $autodiscover_config; |
| 17 | |
| 18 | if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/inc/vars.local.inc.php')) { |
| 19 | include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.local.inc.php'; |
| 20 | } |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 21 | |
| 22 | // auto-generated by generate-config.sh and update.sh |
| 23 | if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/inc/app_info.inc.php')) { |
| 24 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/app_info.inc.php'; |
| 25 | } |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 26 | unset($https_port); |
| 27 | $autodiscover_config = array_merge($default_autodiscover_config, $autodiscover_config); |
| 28 | |
| 29 | header_remove("X-Powered-By"); |
| 30 | |
| 31 | // Yubi OTP API |
| 32 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/Yubico.php'; |
| 33 | |
| 34 | // WebAuthn |
| 35 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/WebAuthn/WebAuthn.php'; |
| 36 | |
| 37 | // Autoload composer |
| 38 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/vendor/autoload.php'; |
| 39 | |
| 40 | // Load Sieve |
| 41 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/sieve/SieveParser.php'; |
| 42 | |
| 43 | // minifierExtended |
| 44 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/JSminifierExtended.php'; |
| 45 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/CSSminifierExtended.php'; |
| 46 | |
| 47 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/array_merge_real.php'; |
| 48 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 49 | // U2F API + T/HOTP API |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 50 | // u2f - deprecated, should be removed |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 51 | $u2f = new u2flib_server\U2F('https://' . $_SERVER['HTTP_HOST']); |
| 52 | $qrprovider = new RobThree\Auth\Providers\Qr\QRServerProvider(); |
| 53 | $tfa = new RobThree\Auth\TwoFactorAuth($OTP_LABEL, 6, 30, 'sha1', $qrprovider); |
| 54 | |
| 55 | // FIDO2 |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 56 | $server_name = parse_url('https://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST); |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 57 | $formats = $GLOBALS['FIDO2_FORMATS']; |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 58 | $WebAuthn = new lbuchs\WebAuthn\WebAuthn('WebAuthn Library', $server_name, $formats); |
| 59 | // only include root ca's when needed |
| 60 | if (getenv('WEBAUTHN_ONLY_TRUSTED_VENDORS') == 'y') $WebAuthn->addRootCertificates($_SERVER['DOCUMENT_ROOT'] . '/inc/lib/WebAuthn/rootCertificates'); |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 61 | |
| 62 | // Redis |
| 63 | $redis = new Redis(); |
| 64 | try { |
| 65 | if (!empty(getenv('REDIS_SLAVEOF_IP'))) { |
| 66 | $redis->connect(getenv('REDIS_SLAVEOF_IP'), getenv('REDIS_SLAVEOF_PORT')); |
| 67 | } |
| 68 | else { |
| 69 | $redis->connect('redis-mailcow', 6379); |
| 70 | } |
| 71 | } |
| 72 | catch (Exception $e) { |
| 73 | ?> |
| 74 | <center style='font-family:sans-serif;'>Connection to Redis failed.<br /><br />The following error was reported:<br/><?=$e->getMessage();?></center> |
| 75 | <?php |
| 76 | exit; |
| 77 | } |
| 78 | |
| 79 | // PDO |
| 80 | // Calculate offset |
| 81 | // $now = new DateTime(); |
| 82 | // $mins = $now->getOffset() / 60; |
| 83 | // $sgn = ($mins < 0 ? -1 : 1); |
| 84 | // $mins = abs($mins); |
| 85 | // $hrs = floor($mins / 60); |
| 86 | // $mins -= $hrs * 60; |
| 87 | // $offset = sprintf('%+d:%02d', $hrs*$sgn, $mins); |
| 88 | |
| 89 | $dsn = $database_type . ":unix_socket=" . $database_sock . ";dbname=" . $database_name; |
| 90 | $opt = [ |
| 91 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
| 92 | PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, |
| 93 | PDO::ATTR_EMULATE_PREPARES => false, |
| 94 | //PDO::MYSQL_ATTR_INIT_COMMAND => "SET time_zone = '" . $offset . "', group_concat_max_len = 3423543543;", |
| 95 | ]; |
| 96 | try { |
| 97 | $pdo = new PDO($dsn, $database_user, $database_pass, $opt); |
| 98 | } |
| 99 | catch (PDOException $e) { |
| 100 | // Stop when SQL connection fails |
| 101 | ?> |
| 102 | <center style='font-family:sans-serif;'>Connection to database failed.<br /><br />The following error was reported:<br/> <?=$e->getMessage();?></center> |
| 103 | <?php |
| 104 | exit; |
| 105 | } |
| 106 | // Stop when dockerapi is not available |
| 107 | if (fsockopen("tcp://dockerapi", 443, $errno, $errstr) === false) { |
| 108 | ?> |
| 109 | <center style='font-family:sans-serif;'>Connection to dockerapi container failed.<br /><br />The following error was reported:<br/><?=$errno;?> - <?=$errstr;?></center> |
| 110 | <?php |
| 111 | exit; |
| 112 | } |
| 113 | |
| 114 | // OAuth2 |
| 115 | class mailcowPdo extends OAuth2\Storage\Pdo { |
| 116 | public function __construct($connection, $config = array()) { |
| 117 | parent::__construct($connection, $config); |
| 118 | $this->config['user_table'] = 'mailbox'; |
| 119 | } |
| 120 | public function checkUserCredentials($username, $password) { |
| 121 | if (check_login($username, $password) == 'user') { |
| 122 | return true; |
| 123 | } |
| 124 | return false; |
| 125 | } |
| 126 | public function getUserDetails($username) { |
| 127 | return $this->getUser($username); |
| 128 | } |
| 129 | } |
| 130 | $oauth2_scope_storage = new OAuth2\Storage\Memory(array('default_scope' => 'profile', 'supported_scopes' => array('profile'))); |
| 131 | $oauth2_storage = new mailcowPdo(array('dsn' => $dsn, 'username' => $database_user, 'password' => $database_pass)); |
| 132 | $oauth2_server = new OAuth2\Server($oauth2_storage, array( |
| 133 | 'refresh_token_lifetime' => $REFRESH_TOKEN_LIFETIME, |
| 134 | 'access_lifetime' => $ACCESS_TOKEN_LIFETIME, |
| 135 | )); |
| 136 | $oauth2_server->setScopeUtil(new OAuth2\Scope($oauth2_scope_storage)); |
| 137 | $oauth2_server->addGrantType(new OAuth2\GrantType\AuthorizationCode($oauth2_storage)); |
| 138 | $oauth2_server->addGrantType(new OAuth2\GrantType\UserCredentials($oauth2_storage)); |
| 139 | $oauth2_server->addGrantType(new OAuth2\GrantType\RefreshToken($oauth2_storage, array( |
| 140 | 'always_issue_new_refresh_token' => true |
| 141 | ))); |
| 142 | |
| 143 | function exception_handler($e) { |
| 144 | if ($e instanceof PDOException) { |
| 145 | $_SESSION['return'][] = array( |
| 146 | 'type' => 'danger', |
| 147 | 'log' => array(__FUNCTION__), |
| 148 | 'msg' => array('mysql_error', $e) |
| 149 | ); |
| 150 | return false; |
| 151 | } |
| 152 | else { |
| 153 | $_SESSION['return'][] = array( |
| 154 | 'type' => 'danger', |
| 155 | 'log' => array(__FUNCTION__), |
| 156 | 'msg' => 'An unknown error occured: ' . print_r($e, true) |
| 157 | ); |
| 158 | return false; |
| 159 | } |
| 160 | } |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 161 | if(!$DEV_MODE) { |
| 162 | set_exception_handler('exception_handler'); |
| 163 | } |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 164 | |
| 165 | // TODO: Move function |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 166 | function get_remote_ip() { |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 167 | $remote = $_SERVER['REMOTE_ADDR']; |
| 168 | if (filter_var($remote, FILTER_VALIDATE_IP) === false) { |
| 169 | return '0.0.0.0'; |
| 170 | } |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 171 | return $remote; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | // Load core functions first |
| 175 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.inc.php'; |
| 176 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php'; |
| 177 | |
| 178 | // IMAP lib |
| 179 | // use Ddeboer\Imap\Server; |
| 180 | // $imap_server = new Server('dovecot', 143, '/imap/tls/novalidate-cert'); |
| 181 | |
| 182 | // Set language |
| 183 | if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) { |
| 184 | if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 185 | // regex inspired from @GabrielAnderson on http://stackoverflow.com/questions/6038236/http-accept-language |
| 186 | preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})*)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse); |
| 187 | |
| 188 | $langs = $lang_parse[1]; |
| 189 | $ranks = $lang_parse[4]; |
| 190 | |
| 191 | // (create an associative array 'language' => 'preference') |
| 192 | $lang2pref = array(); |
| 193 | for ($i=0; $i<count($langs); $i++) { |
| 194 | $lang2pref[strtolower($langs[$i])] = (float) (!empty($ranks[$i]) ? $ranks[$i] : 1); |
| 195 | } |
| 196 | |
| 197 | // (comparison function for uksort) |
| 198 | $cmpLangs = function ($a, $b) use ($lang2pref) { |
| 199 | if ($lang2pref[$a] > $lang2pref[$b]) |
| 200 | return -1; |
| 201 | elseif ($lang2pref[$a] < $lang2pref[$b]) |
| 202 | return 1; |
| 203 | elseif (strlen($a) > strlen($b)) |
| 204 | return -1; |
| 205 | elseif (strlen($a) < strlen($b)) |
| 206 | return 1; |
| 207 | else |
| 208 | return 0; |
| 209 | }; |
| 210 | |
| 211 | // sort the languages by prefered language and by the most specific region |
| 212 | uksort($lang2pref, $cmpLangs); |
| 213 | |
| 214 | // generate language array without the region part |
| 215 | $AVAILABLE_BASE_LANGUAGES=array(); |
| 216 | foreach ($AVAILABLE_LANGUAGES as $code => $lang) { |
| 217 | $base_code = substr($code, 0, 2); |
| 218 | if (!array_key_exists($base_code, $AVAILABLE_BASE_LANGUAGES)) { |
| 219 | $AVAILABLE_BASE_LANGUAGES[$base_code] = $code; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | // Find a perfect match or partial match |
| 224 | // Match en-gb or en |
| 225 | foreach ($lang2pref as $lang => $q) { |
| 226 | if (array_key_exists($lang, $AVAILABLE_LANGUAGES)) { |
| 227 | $_SESSION['mailcow_locale'] = $lang; |
| 228 | break; |
| 229 | } elseif (array_key_exists($lang, $AVAILABLE_BASE_LANGUAGES)) { |
| 230 | $_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[$lang]; |
| 231 | break; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | // Try suggest match |
| 236 | // e.g. suggest en-gb when only en-us is provided |
| 237 | if (!isset($_SESSION['mailcow_locale'])) { |
| 238 | foreach ($lang2pref as $lang => $q) { |
| 239 | if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) { |
| 240 | $_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)]; |
| 241 | break; |
| 242 | } |
| 243 | } |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 244 | } |
| 245 | } |
| 246 | else { |
| 247 | $_SESSION['mailcow_locale'] = strtolower(trim($DEFAULT_LANG)); |
| 248 | } |
| 249 | } |
| 250 | if (isset($_COOKIE['mailcow_locale'])) { |
| 251 | (preg_match('/^[a-z]{2}$/', $_COOKIE['mailcow_locale'])) ? $_SESSION['mailcow_locale'] = $_COOKIE['mailcow_locale'] : setcookie("mailcow_locale", "", time() - 300); |
| 252 | } |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 253 | if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $AVAILABLE_LANGUAGES)) { |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 254 | $_SESSION['mailcow_locale'] = $_GET['lang']; |
| 255 | setcookie("mailcow_locale", $_GET['lang'], time()+30758400); // one year |
| 256 | } |
| 257 | |
| 258 | /* |
| 259 | * load language |
| 260 | */ |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 261 | $lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en-gb.json'), true); |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 262 | |
| 263 | $langFile = $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.'.$_SESSION['mailcow_locale'].'.json'; |
| 264 | if(file_exists($langFile)) { |
| 265 | $lang = array_merge_real($lang, json_decode(file_get_contents($langFile), true)); |
| 266 | } |
| 267 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 268 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 269 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.acl.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 270 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.address_rewriting.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 271 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.admin.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 272 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.app_passwd.inc.php'; |
| 273 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.customize.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 274 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.dkim.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 275 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.docker.inc.php'; |
| 276 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.domain_admin.inc.php'; |
| 277 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.fail2ban.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 278 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.fwdhost.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 279 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.mailbox.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 280 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.mailq.inc.php'; |
| 281 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.oauth2.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 282 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.policy.inc.php'; |
| 283 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.presets.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 284 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.pushover.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 285 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.quarantine.inc.php'; |
| 286 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.quota_notification.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 287 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.ratelimit.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 288 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.rspamd.inc.php'; |
| 289 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.tls_policy_maps.inc.php'; |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 290 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.transports.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 291 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/init_db.inc.php'; |
| 292 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/triggers.inc.php'; |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 293 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/twig.inc.php'; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 294 | init_db_schema(); |
| 295 | if (isset($_SESSION['mailcow_cc_role'])) { |
| 296 | // if ($_SESSION['mailcow_cc_role'] == 'user') { |
| 297 | // list($master_user, $master_passwd) = explode(':', file_get_contents('/etc/sogo/sieve.creds')); |
| 298 | // $imap_connection = $imap_server->authenticate($_SESSION['mailcow_cc_username'] . '*' . trim($master_user), trim($master_passwd)); |
| 299 | // $master_user = $master_passwd = null; |
| 300 | // } |
| 301 | acl('to_session'); |
| 302 | } |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 303 | |
| 304 | // init frontend |
| 305 | // Minify JS |
| 306 | use MatthiasMullie\Minify; |
| 307 | $js_minifier = new JSminifierExtended(); |
| 308 | $js_dir = array_diff(scandir('/web/js/build'), array('..', '.')); |
| 309 | // Minify CSS |
| 310 | $css_minifier = new CSSminifierExtended(); |
| 311 | $css_dir = array_diff(scandir('/web/css/build'), array('..', '.')); |
| 312 | // get customized ui data |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 313 | $UI_TEXTS = customize('get', 'ui_texts'); |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 314 | |
| 315 | |
| 316 | // minify bootstrap theme |
| 317 | if (file_exists('/web/css/themes/'.$UI_THEME.'-bootstrap.css')) |
| 318 | $css_minifier->add('/web/css/themes/'.$UI_THEME.'-bootstrap.css'); |
| 319 | else |
| 320 | $css_minifier->add('/web/css/themes/lumen-bootstrap.css'); |
| 321 | // minify css build files |
| 322 | foreach ($css_dir as $css_file) { |
| 323 | $css_minifier->add('/web/css/build/' . $css_file); |
| 324 | } |
| 325 | // minify js build files |
| 326 | foreach ($js_dir as $js_file) { |
| 327 | $js_minifier->add('/web/js/build/' . $js_file); |
| 328 | } |