forked from mkay/Exim4UI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitechangesubmit.php
111 lines (104 loc) · 4.11 KB
/
sitechangesubmit.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
include_once dirname(__FILE__) . "/config/variables.php";
include_once dirname(__FILE__) . "/config/authsite.php";
include_once dirname(__FILE__) . "/config/functions.php";
include_once dirname(__FILE__) . "/config/httpheaders.php";
if (isset($_POST['spamassassin'])) {$_POST['spamassassin'] = 1;} else {$_POST['spamassassin'] = 0;}
if (isset($_POST['enabled'])) {$_POST['enabled'] = 1;} else {$_POST['enabled'] = 0;}
if (isset($_POST['pipe'])) {$_POST['pipe'] = 1;} else {$_POST['pipe'] = 0;}
if ($_POST['max_accounts'] == '') {$_POST['max_accounts'] = '0';}
if (isset($_POST['clear'])) {
if (validate_password($_POST['clear'], $_POST['vclear'])) {
$query = "UPDATE users SET crypt='" .
crypt_password($_POST['clear']) . "',
clear='{$_POST['clear']}'
WHERE localpart='{$_POST['localpart']}' AND
domain_id='{$_POST['domain_id']}'";
$result = $db->query($query);
if (!DB::isError($result)) {
header ("Location: site.php?updated={$_POST['domain']}");
die;
} else {
header ("Location: site.php?failupdated={$_POST['domain']}");
die;
}
} else {
header ("Location: site.php?badpass={$_POST['domain']}");
die;
}
}
// User can specify either UID, or username, the former being preferred.
// Using posix_getpwuid/posix_getgrgid even when we have an UID is so we
// are sure the UID exists.
if (isset ($_POST['uid'])) {
$uid = $_POST['uid'];
}
if (isset ($_POST['gid'])) {
$gid = $_POST['gid'];
}
if ($userinfo = @posix_getpwuid ($uid)) {
$uid = $userinfo['uid'];
} elseif ($userinfo = @posix_getpwnam ($uid)) {
$uid = $userinfo['uid'];
} else {
header ("Location: site.php?failuidguid={$_POST['domain']}");
die;
}
if ($groupinfo = @posix_getgrgid ($gid)) {
$gid = $groupinfo['gid'];
} elseif ($groupinfo = @posix_getgrnam ($gid)) {
$gid = $groupinfo['gid'];
} else {
header ("Location: site.php?failuidguid={$_POST['domain']}");
die;
}
if ($multi_ip == "yes") {
$query = "UPDATE domains SET uid='$uid',
gid='$gid',
outgoing_ip='{$_POST['outgoingip']}',
maxmsgsize='{$_POST['maxmsgsize']}',
pipe='{$_POST['pipe']}',
max_accounts='{$_POST['max_accounts']}',
quotas='{$_POST['quotas']}',
sa_tag='" . ((isset($_POST['sa_tag'])) ? $_POST['sa_tag'] : 0) . "',
sa_refuse='" .((isset($_POST['sa_refuse'])) ? $_POST['sa_refuse'] : 0) . "',
spamassassin='{$_POST['spamassassin']}',
enabled='{$_POST['enabled']}' WHERE domain_id='{$_POST['domain_id']}'";
$result = $db->query($query);
if (!DB::isError($result)) {
header ("Location: site.php?updated={$_POST['domain']}");
die;
} else {
header ("Location: site.php?failupdated={$_POST['domain']}");
die;
}
} else {
$query = "UPDATE domains SET uid='$uid',
gid='$gid',
maxmsgsize='{$_POST['maxmsgsize']}',
pipe='{$_POST['pipe']}',
max_accounts='{$_POST['max_accounts']}',
quotas='{$_POST['quotas']}',
sa_tag='" . ((isset($_POST['sa_tag'])) ? $_POST['sa_tag'] : 0) . "',
sa_refuse='" .((isset($_POST['sa_refuse'])) ? $_POST['sa_refuse'] : 0) . "',
spamassassin='{$_POST['spamassassin']}',
enabled='{$_POST['enabled']}' WHERE domain_id='{$_POST['domain_id']}'";
$result = $db->query($query);
if (!DB::isError($result)) {
header ("Location: site.php?updated={$_POST['domain']}");
die;
} else {
header ("Location: site.php?failupdated={$_POST['domain']}");
die;
}
}
if (isset($_POST['sadisable'])) {
$query = "UPDATE users SET on_spamassassin='0' WHERE domain_id='{$_POST['domain_id']}'";
$result = $db->query($query);
if (DB::isError($result)) { $result->getMessage(); }
header ("Location: site.php?updated={$_POST['domain']}");
die;
}
# Just-in-case catchall
header ("Location: site.php?failupdated={$_POST['domain']}");
?>