dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
dbxContactConfig.class.php
Go to the documentation of this file.
1<?php
2namespace dbx\dbxContact;
3
5
6 public static function isFlagEnabled($value, bool $default = false): bool {
7 $value = strtolower(trim((string) $value));
8 if ($value === '') {
9 return $default;
10 }
11 if (in_array($value, array('0', 'no', 'off', 'false', 'nein'), true)) {
12 return false;
13 }
14 if (in_array($value, array('1', 'yes', 'on', 'true', 'ja'), true)) {
15 return true;
16 }
17 return $default;
18 }
19
20 public static function mailAdminOnRequest(): bool {
21 $val = dbx()->get_config('dbxContact', 'mail_admin_on_request');
22 return self::isFlagEnabled($val, true);
23 }
24
25 public static function mailConfirmRequester(): bool {
26 $val = dbx()->get_config('dbxContact', 'mail_confirm_requester');
27 if (trim((string) $val) === '') {
28 return true;
29 }
30 return self::isFlagEnabled($val, true);
31 }
32
33 public static function mailOnReply(): bool {
34 $val = dbx()->get_config('dbxContact', 'mail_on_reply');
35 return self::isFlagEnabled($val, true);
36 }
37
38 public static function modulMailEnabled(string $modul, string $key): bool {
39 if ($modul === 'dbxContact') {
40 if ($key === 'mail_on_reply') {
41 return self::mailOnReply();
42 }
43 if ($key === 'mail_admin_on_request') {
44 return self::mailAdminOnRequest();
45 }
46 if ($key === 'mail_confirm_requester') {
47 return self::mailConfirmRequester();
48 }
49 }
50
51 $val = dbx()->get_config($modul, $key);
52 if (self::isFlagEnabled($val, false)) {
53 return true;
54 }
55
56 $mode = strtolower(trim((string) $val));
57 return ($mode === 'both' || $mode === 'mail' || strpos($mode, 'mail') !== false);
58 }
59}
static isFlagEnabled($value, bool $default=false)
static modulMailEnabled(string $modul, string $key)
if( $syncRequest)
Definition index.php:520
DBX schema administration.