git subrepo commit (merge) mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "c7b1dc37"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "a366494c"
git-subrepo: version: "0.4.6"
origin: "???"
commit: "???"
Change-Id: Id574ecd4e02e3c4fbf8a1efd49be11c0b6d19a3f
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php b/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
index 16c5c03..0da8c35 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/functions.customize.inc.php
@@ -24,9 +24,10 @@
}
switch ($_item) {
case 'main_logo':
- if (in_array($_data['main_logo']['type'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/svg+xml'))) {
+ case 'main_logo_dark':
+ if (in_array($_data[$_item]['type'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/svg+xml'))) {
try {
- if (file_exists($_data['main_logo']['tmp_name']) !== true) {
+ if (file_exists($_data[$_item]['tmp_name']) !== true) {
$_SESSION['return'][] = array(
'type' => 'danger',
'log' => array(__FUNCTION__, $_action, $_item, $_data),
@@ -34,7 +35,7 @@
);
return false;
}
- $image = new Imagick($_data['main_logo']['tmp_name']);
+ $image = new Imagick($_data[$_item]['tmp_name']);
if ($image->valid() !== true) {
$_SESSION['return'][] = array(
'type' => 'danger',
@@ -63,7 +64,7 @@
return false;
}
try {
- $redis->Set('MAIN_LOGO', 'data:' . $_data['main_logo']['type'] . ';base64,' . base64_encode(file_get_contents($_data['main_logo']['tmp_name'])));
+ $redis->Set(strtoupper($_item), 'data:' . $_data[$_item]['type'] . ';base64,' . base64_encode(file_get_contents($_data[$_item]['tmp_name'])));
}
catch (RedisException $e) {
$_SESSION['return'][] = array(
@@ -160,6 +161,25 @@
'msg' => 'ui_texts'
);
break;
+ case 'ip_check':
+ $ip_check = ($_data['ip_check_opt_in'] == "1") ? 1 : 0;
+ try {
+ $redis->set('IP_CHECK', $ip_check);
+ }
+ catch (RedisException $e) {
+ $_SESSION['return'][] = array(
+ 'type' => 'danger',
+ 'log' => array(__FUNCTION__, $_action, $_item, $_data),
+ 'msg' => array('redis_error', $e)
+ );
+ return false;
+ }
+ $_SESSION['return'][] = array(
+ 'type' => 'success',
+ 'log' => array(__FUNCTION__, $_action, $_item, $_data),
+ 'msg' => 'ip_check_opt_in_modified'
+ );
+ break;
}
break;
case 'delete':
@@ -182,8 +202,9 @@
}
switch ($_item) {
case 'main_logo':
+ case 'main_logo_dark':
try {
- if ($redis->del('MAIN_LOGO')) {
+ if ($redis->del(strtoupper($_item))) {
$_SESSION['return'][] = array(
'type' => 'success',
'log' => array(__FUNCTION__, $_action, $_item, $_data),
@@ -220,8 +241,9 @@
return ($app_links) ? $app_links : false;
break;
case 'main_logo':
+ case 'main_logo_dark':
try {
- return $redis->get('MAIN_LOGO');
+ return $redis->get(strtoupper($_item));
}
catch (RedisException $e) {
$_SESSION['return'][] = array(
@@ -258,9 +280,14 @@
}
break;
case 'main_logo_specs':
+ case 'main_logo_dark_specs':
try {
$image = new Imagick();
- $img_data = explode('base64,', customize('get', 'main_logo'));
+ if($_item == 'main_logo_specs') {
+ $img_data = explode('base64,', customize('get', 'main_logo'));
+ } else {
+ $img_data = explode('base64,', customize('get', 'main_logo_dark'));
+ }
if ($img_data[1]) {
$image->readImageBlob(base64_decode($img_data[1]));
return $image->identifyImage();
@@ -276,6 +303,20 @@
return false;
}
break;
+ case 'ip_check':
+ try {
+ $ip_check = ($ip_check = $redis->get('IP_CHECK')) ? $ip_check : 0;
+ return $ip_check;
+ }
+ catch (RedisException $e) {
+ $_SESSION['return'][] = array(
+ 'type' => 'danger',
+ 'log' => array(__FUNCTION__, $_action, $_item, $_data),
+ 'msg' => array('redis_error', $e)
+ );
+ return false;
+ }
+ break;
}
break;
}