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

subrepo: subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "32243e56"
upstream: origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "e2b4b6f6"
git-subrepo: version:  "0.4.3"
  origin:   "???"
  commit:   "???"
Change-Id: I51e2016ef5ab88a8b0bdc08551b18f48ceef0aa5
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/twig.inc.php b/mailcow/src/mailcow-dockerized/data/web/inc/twig.inc.php
new file mode 100644
index 0000000..081ca31
--- /dev/null
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/twig.inc.php
@@ -0,0 +1,27 @@
+<?php
+
+use Twig\Environment;
+use Twig\Loader\FilesystemLoader;
+use Twig\TwigFilter;
+use Twig\TwigFunction;
+
+$loader = new FilesystemLoader($_SERVER['DOCUMENT_ROOT'].'/templates');
+$twig = new Environment($loader, [
+  'debug' => $DEV_MODE,
+  'cache' => $_SERVER['DOCUMENT_ROOT'].'/templates/cache',
+]);
+
+// functions
+$twig->addFunction(new TwigFunction('query_string', function (array $params = []) {
+  return http_build_query(array_merge($_GET, $params));
+}));
+
+$twig->addFunction(new TwigFunction('is_uri', function (string $uri, string $where = null) {
+  if (is_null($where)) $where = $_SERVER['REQUEST_URI'];
+  return preg_match('/'.$uri.'/i', $where);
+}));
+
+// filters
+$twig->addFilter(new TwigFilter('rot13', 'str_rot13'));
+$twig->addFilter(new TwigFilter('base64_encode', 'base64_encode'));
+$twig->addFilter(new TwigFilter('formatBytes', 'formatBytes'));