@@ -1478,7 +1478,11 @@ function removeLine($filename, $search_pattern, $strict = 0) {
14781478
14791479 function maildirmake ($ maildir_path , $ user = '' , $ subfolder = '' ) {
14801480
1481- global $ app ;
1481+ global $ app , $ conf ;
1482+
1483+ // load the server configuration options
1484+ $ app ->uses ("getconf " );
1485+ $ mail_config = $ app ->getconf ->get_server_config ($ conf ["server_id " ], 'mail ' );
14821486
14831487 if ($ subfolder != '' ) {
14841488 $ dir = escapeshellcmd ($ maildir_path .'/. ' .$ subfolder );
@@ -1521,25 +1525,30 @@ function maildirmake($maildir_path, $user = '', $subfolder = '') {
15211525
15221526 //* Add the subfolder to the subscriptions and courierimapsubscribed files
15231527 if ($ subfolder != '' ) {
1528+
15241529 // Courier
1525- if (!is_file ($ maildir_path .'/courierimapsubscribed ' )) {
1526- $ tmp_file = escapeshellcmd ($ maildir_path .'/courierimapsubscribed ' );
1527- touch ($ tmp_file );
1528- chmod ($ tmp_file , 0744 );
1529- chown ($ tmp_file , 'vmail ' );
1530- chgrp ($ tmp_file , 'vmail ' );
1530+ if ($ mail_config ['pop3_imap_daemon ' ] == 'courier ' ) {
1531+ if (!is_file ($ maildir_path .'/courierimapsubscribed ' )) {
1532+ $ tmp_file = escapeshellcmd ($ maildir_path .'/courierimapsubscribed ' );
1533+ touch ($ tmp_file );
1534+ chmod ($ tmp_file , 0744 );
1535+ chown ($ tmp_file , 'vmail ' );
1536+ chgrp ($ tmp_file , 'vmail ' );
1537+ }
1538+ $ this ->replaceLine ($ maildir_path .'/courierimapsubscribed ' , 'INBOX. ' .$ subfolder , 'INBOX. ' .$ subfolder , 1 , 1 );
15311539 }
1532- $ this ->replaceLine ($ maildir_path .'/courierimapsubscribed ' , 'INBOX. ' .$ subfolder , 'INBOX. ' .$ subfolder , 1 , 1 );
15331540
15341541 // Dovecot
1535- if (!is_file ($ maildir_path .'/subscriptions ' )) {
1536- $ tmp_file = escapeshellcmd ($ maildir_path .'/subscriptions ' );
1537- touch ($ tmp_file );
1538- chmod ($ tmp_file , 0744 );
1539- chown ($ tmp_file , 'vmail ' );
1540- chgrp ($ tmp_file , 'vmail ' );
1542+ if ($ mail_config ['pop3_imap_daemon ' ] == 'dovecot ' ) {
1543+ if (!is_file ($ maildir_path .'/subscriptions ' )) {
1544+ $ tmp_file = escapeshellcmd ($ maildir_path .'/subscriptions ' );
1545+ touch ($ tmp_file );
1546+ chmod ($ tmp_file , 0744 );
1547+ chown ($ tmp_file , 'vmail ' );
1548+ chgrp ($ tmp_file , 'vmail ' );
1549+ }
1550+ $ this ->replaceLine ($ maildir_path .'/subscriptions ' , $ subfolder , $ subfolder , 1 , 1 );
15411551 }
1542- $ this ->replaceLine ($ maildir_path .'/subscriptions ' , $ subfolder , $ subfolder , 1 , 1 );
15431552 }
15441553
15451554 $ app ->log ('Created Maildir ' .$ maildir_path .' with subfolder: ' .$ subfolder , LOGLEVEL_DEBUG );
0 commit comments