Skip to content

Commit 49238a9

Browse files
author
Kristan Kenney
committed
Merge branch 'bugfix-webmail-url' into webui-refresh-winterfell
2 parents 91c5c09 + 4daeaf7 commit 49238a9

File tree

8 files changed

+39
-18
lines changed

8 files changed

+39
-18
lines changed

bin/v-list-mail-account

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ format=${4-shell}
1717

1818
# Includes
1919
source $HESTIA/func/main.sh
20+
source $HESTIA/conf/hestia.conf
2021

2122
# JSON list function
2223
json_list() {
@@ -30,7 +31,8 @@ json_list() {
3031
"U_DISK": "'$U_DISK'",
3132
"SUSPENDED": "'$SUSPENDED'",
3233
"TIME": "'$TIME'",
33-
"DATE": "'$DATE'"
34+
"DATE": "'$DATE'",
35+
"WEBMAIL_ALIAS": "'$WEBMAIL_ALIAS.$domain'"
3436
}'
3537
echo '}'
3638
}
@@ -47,20 +49,21 @@ shell_list() {
4749
echo "SUSPENDED: $SUSPENDED"
4850
echo "TIME: $TIME"
4951
echo "DATE: $DATE"
52+
echo "WEBMAIL_ALIAS: $WEBMAIL_ALIAS.$domain"
5053
}
5154

5255
# PLAIN list function
5356
plain_list() {
5457
echo -ne "$account\t$ALIAS\t$FWD\t$FWD_ONLY\t$AUTOREPLY\t$QUOTA\t"
55-
echo -e "$U_DISK\t$SUSPENDED\t$TIME\t$DATE"
58+
echo -e "$U_DISK\t$SUSPENDED\t$TIME\t$DATE\t$WEBMAIL_ALIAS.$domain"
5659
}
5760

5861
# CSV list function
5962
csv_list() {
6063
echo -n "ACCOUNT,ALIAS,FWD,FWD_ONLY,AUTOREPLY,QUOTA,U_DISK"
6164
echo "SUSPENDED,TIME,DATE"
6265
echo -n "$ACCOUNT,\"$ALIAS\",\"$FWD\",$FWD_ONLY,$AUTOREPLY,$QUOTA,"
63-
echo "$U_DISK,$SUSPENDED,$TIME,$DATE"
66+
echo "$U_DISK,$SUSPENDED,$TIME,$DATE\t$WEBMAIL_ALIAS.$domain"
6467
}
6568

6669

bin/v-list-mail-domain

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ format=${3-shell}
1616

1717
# Includes
1818
source $HESTIA/func/main.sh
19+
source $HESTIA/conf/hestia.conf
1920

2021
# JSON list function
2122
json_list() {
@@ -32,8 +33,9 @@ json_list() {
3233
"LETSENCRYPT": "'$LETSENCRYPT'",
3334
"SUSPENDED": "'$SUSPENDED'",
3435
"TIME": "'$TIME'",
35-
"DATE": "'$DATE'"
36-
}'
36+
"DATE": "'$DATE'",
37+
"WEBMAIL_ALIAS": "'$WEBMAIL_ALIAS.$domain'"
38+
}'
3739
echo '}'
3840
}
3941

@@ -51,20 +53,21 @@ shell_list() {
5153
echo "SUSPENDED: $SUSPENDED"
5254
echo "TIME: $TIME"
5355
echo "DATE: $DATE"
56+
echo "WEBMAIL_ALIAS: $WEBMAIL_ALIAS.$domain"
5457
}
5558

5659
# PLAIN list function
5760
plain_list() {
5861
echo -ne "$DOMAIN\t$ANTIVIRUS\t$ANTISPAM\t$DKIM\t$CATCHALL\t"
59-
echo -e "$ACCOUNTS\t$U_DISK\t$SSL\t$LETSENCRYPT\t$SUSPENDED\t$TIME\t$DATE"
62+
echo -e "$ACCOUNTS\t$U_DISK\t$SSL\t$LETSENCRYPT\t$SUSPENDED\t$TIME\t$DATE\t$WEBMAIL_ALIAS.$domain"
6063
}
6164

6265
# CSV list function
6366
csv_list() {
6467
echo -n "DOMAIN,ANTIVIRUS,ANTISPAM,DKIM,CATCHALL,ACCOUNTS,U_DISK,"
6568
echo "SSL,LETSENCRYPT,SUSPENDED,TIME,DATE"
6669
echo -n "$DOMAIN,$ANTIVIRUS,$ANTISPAM,$DKIM,$CATCHALL,$ACCOUNTS,$U_DISK"
67-
echo "$SSL,$LETSENCRYPT,$SUSPENDED,$TIME,$DATE"
70+
echo "$SSL,$LETSENCRYPT,$SUSPENDED,$TIME,$DATE,$WEBMAIL_ALIAS.$domain"
6871
}
6972

7073

install/upgrade/0.10.0-190430.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ HESTIA_BACKUP="/root/hst_upgrade/$(date +%d%m%Y%H%M)"
66
hestiacp="$HESTIA/install/deb"
77

88
# Add webmail alias variable to system configuration if non-existent
9-
webmail_alias_check=$(cat $HESTIA/conf/hestia.conf | grep WEBMAIL_ALIAS)
9+
WEBMAIL_ALIAS_CHECK=$(cat $HESTIA/conf/hestia.conf | grep WEBMAIL_ALIAS)
1010
if [ -z "$WEBMAIL_ALIAS_CHECK" ]; then
1111
echo "(*) Adding global webmail alias to system configuration..."
1212
sed -i "/WEBMAIL_ALIAS/d" $HESTIA/conf/hestia.conf

web/add/mail/index.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@
66
// Main include
77
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
88

9+
// Get all user domains
10+
exec (HESTIA_CMD."v-list-mail-domains ".escapeshellarg($user)." json", $output, $return_var);
11+
$user_domains = json_decode(implode('', $output), true);
12+
$user_domains = array_keys($user_domains);
13+
unset($output);
14+
15+
$v_domain = $_GET['domain'];
16+
if(!empty($v_domain)){
17+
if(!in_array($v_domain, $user_domains)) {
18+
header("Location: /list/mail/");
19+
exit;
20+
}
21+
// Set webmail alias
22+
exec (HESTIA_CMD."v-list-mail-domain ".escapeshellarg($user)." ".escapeshellarg($v_domain)." json", $output, $return_var);
23+
$data = json_decode(implode('', $output), true);
24+
unset($output);
25+
$v_webmail_alias = $data[$v_domain]['WEBMAIL_ALIAS'];
26+
}
927

1028
// Check POST request for mail domain
1129
if (!empty($_POST['ok'])) {

web/edit/mail/index.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
$v_date = $data[$v_domain]['DATE'];
4646
$v_time = $data[$v_domain]['TIME'];
4747
$v_suspended = $data[$v_domain]['SUSPENDED'];
48+
$v_webmail_alias = $data[$v_domain]['WEBMAIL_ALIAS'];
49+
4850
if ( $v_suspended == 'yes' ) {
4951
$v_status = 'suspended';
5052
} else {
@@ -96,6 +98,7 @@
9698
$v_quota = $data[$v_account]['QUOTA'];
9799
$v_autoreply = $data[$v_account]['AUTOREPLY'];
98100
$v_suspended = $data[$v_account]['SUSPENDED'];
101+
$v_webmail_alias = $data[$v_account]['WEBMAIL_ALIAS'];
99102
if ( $v_suspended == 'yes' ) {
100103
$v_status = 'suspended';
101104
} else {

web/templates/admin/add_mail_acc.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,9 @@
188188
<td><?=__('SMTP auth method')?>:</td>
189189
<td><div><?=__('Normal password')?></div></td>
190190
</tr>
191-
<?
192-
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
193-
$webmail = "http://webmail.".$v_domain."/";
194-
?>
195191
<tr>
196192
<td><?=__('Webmail URL')?>:</td>
197-
<td><div><a class="vst" href="<?=$webmail?>" target="_blank"><?=$webmail?> <i></i></a></div></td>
193+
<td><div><a class="vst" href="http://<?=$v_webmail_alias?>" target="_blank">http://<?=$v_webmail_alias?> <i></i></a></div></td>
198194
</tr>
199195
</table>
200196
</div>

web/templates/admin/edit_mail_acc.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,9 @@
199199
<td><?=__('SMTP auth method')?>:</td>
200200
<td><div><?=__('Normal password')?></div></td>
201201
</tr>
202-
<?
203-
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
204-
$webmail = "http://webmail.".$v_domain."/";
205-
?>
206202
<tr>
207203
<td><?=__('Webmail URL')?>:</td>
208-
<td><div><a class="vst" href="<?=$webmail?>" target="_blank"><?=$webmail?> <i></i></a></div></td>
204+
<td><div><a class="vst" href="http://<?=$v_webmail_alias?>" target="_blank">http://<?=$v_webmail_alias?> <i></i></a></div></td>
209205
</tr>
210206
</table>
211207
</div>

web/templates/user/list_user.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<option value="rebuild db"><?=__('rebuild db')?></option>
3737
<option value="rebuild cron"><?=__('rebuild cron')?></option>
3838
<option value="update counters"><?=__('update counters')?></option>
39+
<option value="suspend"><?= __('suspend')?></option>
40+
<option value="unsuspend"><?=__('unsuspend')?></option>
3941
<option value="delete"><?=__('delete')?></option>
4042
</select>
4143
</div>

0 commit comments

Comments
 (0)