NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
twig.inc.php
<?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 = []) {
  $allowed = ['lang', 'mobileconfig'];
  $filtered = array_intersect_key($_GET, array_flip($allowed));
  return http_build_query(array_merge($filtered, $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'));