Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Application | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| initialize | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 5 | **/ |
| 6 | |
| 7 | namespace BO\Zmsadmin; |
| 8 | |
| 9 | use BO\Slim\Helper\ModuleLoggerInitializer; |
| 10 | use BO\Zmsclient\Http; |
| 11 | use Psr\SimpleCache\CacheInterface; |
| 12 | |
| 13 | define( |
| 14 | 'ZMS_ADMIN_TEMPLATE_FOLDER', |
| 15 | getenv('ZMS_ADMIN_TEMPLATE_FOLDER') ? getenv('ZMS_ADMIN_TEMPLATE_FOLDER') : '/templates/' |
| 16 | ); |
| 17 | |
| 18 | define( |
| 19 | 'ZMS_ADMIN_SESSION_DURATION', |
| 20 | getenv('ZMS_ADMIN_SESSION_DURATION') ? getenv('ZMS_ADMIN_SESSION_DURATION') : 28800 |
| 21 | ); |
| 22 | |
| 23 | if (($token = getenv('ZMS_CONFIG_SECURE_TOKEN')) === false || $token === '') { |
| 24 | throw new \RuntimeException('ZMS_CONFIG_SECURE_TOKEN environment variable must be set'); |
| 25 | } |
| 26 | |
| 27 | define('ZMS_CONFIG_SECURE_TOKEN', getenv('ZMS_CONFIG_SECURE_TOKEN')); |
| 28 | |
| 29 | if (!defined('ZMS_ADMIN_TWIG_CACHE')) { |
| 30 | $value = getenv('ZMS_ADMIN_TWIG_CACHE'); |
| 31 | define('ZMS_ADMIN_TWIG_CACHE', ($value === 'false') ? false : ($value ?: '/cache/')); |
| 32 | } |
| 33 | |
| 34 | class Application extends \BO\Slim\Application |
| 35 | { |
| 36 | /** |
| 37 | * Name of the application |
| 38 | * |
| 39 | */ |
| 40 | const IDENTIFIER = 'zms'; |
| 41 | |
| 42 | const MODULE_NAME = 'zmsadmin'; |
| 43 | |
| 44 | public static ?CacheInterface $cache = null; |
| 45 | |
| 46 | const DEBUG = false; |
| 47 | |
| 48 | const TWIG_CACHE = ZMS_ADMIN_TWIG_CACHE; |
| 49 | |
| 50 | const TEMPLATE_PATH = ZMS_ADMIN_TEMPLATE_FOLDER; |
| 51 | |
| 52 | const SESSION_DURATION = ZMS_ADMIN_SESSION_DURATION; |
| 53 | |
| 54 | public static $includeUrl = '/terminvereinbarung/admin'; |
| 55 | |
| 56 | /** |
| 57 | * allow cluster wide process calls |
| 58 | */ |
| 59 | |
| 60 | public static $allowClusterWideCall = true; |
| 61 | |
| 62 | /** |
| 63 | * image preferences |
| 64 | */ |
| 65 | |
| 66 | public static $isImageAllowed = false; |
| 67 | |
| 68 | /** |
| 69 | * language preferences |
| 70 | */ |
| 71 | const MULTILANGUAGE = true; |
| 72 | |
| 73 | public static $locale = 'de'; |
| 74 | public static $supportedLanguages = array( |
| 75 | // Default language |
| 76 | 'de' => array( |
| 77 | 'name' => 'Deutsch', |
| 78 | 'locale' => 'de_DE', |
| 79 | 'default' => true, |
| 80 | ), |
| 81 | // Other languages |
| 82 | 'en' => array( |
| 83 | 'name' => 'English', |
| 84 | 'locale' => 'en_GB', |
| 85 | ) |
| 86 | ); |
| 87 | |
| 88 | /** |
| 89 | * config preferences |
| 90 | */ |
| 91 | const CONFIG_SECURE_TOKEN = ZMS_CONFIG_SECURE_TOKEN; |
| 92 | |
| 93 | /** |
| 94 | * signature key for url signature to save query paramter with hash |
| 95 | */ |
| 96 | public static $urlSignatureSecret = ZMS_CONFIG_SECURE_TOKEN; |
| 97 | |
| 98 | /** |
| 99 | * ----------------------------------------------------------------------- |
| 100 | * ZMS API access |
| 101 | * @var Http $http |
| 102 | */ |
| 103 | public static $http = null; |
| 104 | |
| 105 | public static $http_curl_config = array(); |
| 106 | |
| 107 | const CLIENTKEY = ''; |
| 108 | |
| 109 | const JSON_COMPRESS_LEVEL = 1; |
| 110 | |
| 111 | /** |
| 112 | * HTTP url for api |
| 113 | */ |
| 114 | const HTTP_BASE_URL = 'http://user:pass@host.tdl'; |
| 115 | |
| 116 | public static function initialize(): void |
| 117 | { |
| 118 | ModuleLoggerInitializer::configure('ZMS_ADMIN'); |
| 119 | self::$cache = ModuleLoggerInitializer::tryInitializeCache(); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | Application::initialize(); |