From 9422d4df7d30b92b4e04e6e4cdab774a8fdb1fc6 Mon Sep 17 00:00:00 2001 From: Giam Teck Choon Date: Sat, 22 Oct 2016 17:11:50 +0800 Subject: [PATCH 1/4] Fixes to support vmailmgr-0.97 as it has additional has_mailbox flag Signed-off-by: Giam Teck Choon --- edit.php | 2 +- main.php | 4 ++-- vm/vm.interface.php | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/edit.php b/edit.php index f70924a..5a9f1a4 100644 --- a/edit.php +++ b/edit.php @@ -42,7 +42,7 @@ if($form['expiry'] != '-') { $form['account_enabled'] = $form['flags']['mailbox_enabled']; /* forward */ -if($form['mailboxdir'] == '') { +if($form['mailboxdir'] == '' || $form['has_mailbox'] == '') { if(isset($_SESSION['stored_forms'][$_GET['key']])) { $form = array_merge($form, $_SESSION['stored_forms'][$_GET['key']]); diff --git a/main.php b/main.php index d853b97..df90711 100644 --- a/main.php +++ b/main.php @@ -139,13 +139,13 @@ else { } echo template_replace($info['flags']['mailbox_enabled'] ? $parts['main_table_element'] : $parts['main_table_element_disabled'], array( - 'type' => $info['mailboxdir'] == '' ? '' : '', + 'type' => ($info['mailboxdir'] == '' || $info['has_mailbox'] == '') ? '' : '', 'username' => $info['username'], 'username_urlescaped' => rawurlencode($info['username']), 'domain' => $_SESSION['domain'], 'personal' => $info['personal'], 'forwards' => $forwards, - 'autoresponse' => $info['mailboxdir'] == '' ? '' : ($vm->autoresponse_isset($info['username']) ? $language['main']['enabled'] : $language['main']['disabled']), + 'autoresponse' => ($info['mailboxdir'] == '' || $info['has_mailbox'] == '') ? '' : ($vm->autoresponse_isset($info['username']) ? $language['main']['enabled'] : $language['main']['disabled']), 'image_edit' => $parts['image_edit'], 'image_remove' => $parts['image_remove'] )); diff --git a/vm/vm.interface.php b/vm/vm.interface.php index 0b12061..b62e1f9 100644 --- a/vm/vm.interface.php +++ b/vm/vm.interface.php @@ -172,7 +172,11 @@ class vmailmgr { case 9: $info[$count]['flags']['personal'] = ($flag_val == 1); - break; + break; + + case 10: + $info[$count]['flags']['has_mailbox'] = ($flag_val == 1); + break; } } @@ -194,6 +198,7 @@ class vmailmgr { $info[$count]['messagecount'] = $list[++$i]; $info[$count]['creation'] = $list[++$i]; $info[$count]['expiry'] = $list[++$i]; + $info[$count]['has_mailbox'] = $info[$count]['flags']['has_mailbox']; ++$count; } @@ -262,7 +267,11 @@ class vmailmgr { case 9: $info['flags']['personal'] = ($flag_val == 1); - break; + break; + + case 10: + $info['flags']['has_mailbox'] = ($flag_val == 1); + break; } } @@ -284,7 +293,8 @@ class vmailmgr { $info['messagecount'] = $list[++$i]; $info['creation'] = $list[++$i]; $info['expiry'] = $list[++$i]; - + $info['has_mailbox'] = $info['flags']['has_mailbox']; + return $info; } -- 1.8.3.1