From 36446d408ed65c2028995e7e4474788573471c13 Mon Sep 17 00:00:00 2001 From: Giam Teck Choon Date: Wed, 21 Aug 2013 02:17:02 +0800 Subject: [PATCH 1/2] Add support for vmailmgr version 0.97 vmailmgr version 0.97 has one additional flag which is case 10 for has_mailbox. This patch fix up the forwarder showing as mailbox issue. Signed-off-by: Giam Teck Choon --- edit.php | 2 +- main.php | 2 +- vm/vm.interface.php | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 5 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..33eb8ba 100644 --- a/main.php +++ b/main.php @@ -139,7 +139,7 @@ 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'], diff --git a/vm/vm.interface.php b/vm/vm.interface.php index 0b12061..64188ae 100644 --- a/vm/vm.interface.php +++ b/vm/vm.interface.php @@ -14,6 +14,10 @@ * */ +/* Modified by Giam Teck Choon + * to support vmailmgr-0.97 + */ + class vmailmgr { /* private: domain and password */ @@ -172,7 +176,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 +202,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 +271,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 +297,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.4