This repository has been archived by the owner on Aug 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddresses.php
65 lines (58 loc) · 1.85 KB
/
addresses.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
include('./inc/_prepend.php');
include('./inc/panel_filter.php');
$oma->current_user->domain_set = $oma->get_domain_set($oma->current_user->mbox, $oma->current_user->domains);
$oma->current_user->used_alias = $oma->user_get_used_alias($oma->current_user->mbox);
// PERFORM ACTION
if(isset($_POST['frm']) && $_POST['frm'] == 'virtual') {
if(!isset($_POST['action'])) {
error(txt('112'));
} else {
if($_POST['action'] == 'new' || $_POST['action'] == 'dest') {
// Set at least one valid destination.
if(isset($_POST['dest_is_mbox']) && $_POST['dest_is_mbox'] == '1') {
$destination = array($oma->current_user->mbox);
} else {
$destination = $oma->get_valid_destinations($_POST['dest']);
if(count($destination) < 1) {
$destination = array($oma->current_user->mbox);
error(txt('10'));
}
}
}
// We need addresses as parameters for every action except the creation of new addresses.
if($_POST['action'] != 'new' && (!isset($_POST['address']) || !is_array($_POST['address']))) {
error(txt('11'));
} else {
switch($_POST['action']) {
case 'new':
$oma->address_create(trim($_POST['alias']), $_POST['domain'], $destination);
break;
case 'delete':
$oma->address_delete($_POST['address']);
break;
case 'dest':
$oma->address_change_destination($_POST['address'], $destination);
break;
case 'active':
$oma->address_toggle_active($_POST['address']);
break;
}
unset($destination);
if($ErrorHandler->errors_occured()) {
error($ErrorHandler->errors_get());
}
if($ErrorHandler->info_occured()) {
info($ErrorHandler->info_get());
}
}
}
}
// DATA
$alias = $oma->get_addresses();
// DISPLAY
include('./templates/'.$cfg['theme'].'/addresses/list.tpl');
// ADMIN PANEL
include('./templates/'.$cfg['theme'].'/addresses/admin.tpl');
include('./inc/_append.php');
?>