forked from web-cyradm/web-cyradm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewalias.php
128 lines (110 loc) · 3.04 KB
/
newalias.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
if (!defined('WC_BASE')) define('WC_BASE', dirname(__FILE__));
$ref=WC_BASE."/index.php";
if ($ref!=$_SERVER['SCRIPT_FILENAME']){
header("Location: index.php");
exit();
}
?>
<!-- #################################### Start newalias.php ################################# -->
<tr>
<td width="10"> </td>
<td valign="top">
<h3>
<?php print _("Add new alias to domain");?>
<span style="color: red;">
<?php echo $_GET['domain'];?>
</span>
</h3>
<?php
require_once WC_BASE . '/config/conf.php';
$query1 = "SELECT * FROM domain WHERE domain_name='$domain'";
$handle = DB::connect($DB['DSN'], true);
if (DB::isError($handle)) {
die (_("Database error"));
}
$result1 = $handle->query($query1);
$row = $result1->fetchRow(DB_FETCHMODE_ASSOC, 0);
$prefix = $row['prefix'];
$maxaccounts = $row['maxaccounts'];
$def_quota = $row['quota'];
$transport = $row['transport'];
// START Andreas Kreisl : freenames
$freenames = $row['freenames'];
// END Andreas Kreisl : freenames
$freeaddress = $row['freeaddress'];
if ($transport != "cyrus"){
die (_("transport is not cyrus, unable to create account"));
}
if (empty($confirmed)){
$query2 = "SELECT * FROM virtual WHERE username='$prefix' order by alias";
$result2 = $handle->query($query2);
$cnt2 = $result2->numRows($result2);
if ($cnt2+1 > $maxaccounts){
?>
<h3>
<?php print _("Sorry, no more alias allowed for domain");?>
<span style="color: red;">
<?php echo $domain;?>
</span>
<br>
<?php print _("Maximum allowed aliases is");?>
<span style="font-weight: bolder;">
<?php echo $maxaccounts;?>
</span>
<?php
} else {
?>
<form method="get" action="index.php">
<input type="hidden"
name="domain"
value="<?php echo $_GET['domain']; ?>"
>
<input type="hidden"
name="action"
value="editalias"
>
<table>
<tr>
<td>
<?php print _("Email address");?>
</td>
<td>
<input
type="text"
name="alias"
size="30"
maxlength="50"
value="<?php if (! empty($_GET['alias'])){ echo $_GET['alias']; } ?>"
class="inputfield"
onfocus="this.style.backgroundColor='#aaaaaa'"
>@<?php
echo $_GET['domain'];
?>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input
name="create"
class="button"
type="submit"
value="<?php print _("Submit"); ?>"
>
<input
name="reset"
class="buttoN"
type="reset"
value="<?php print _("Cancel"); ?>"
>
</td>
</tr>
</table>
</form>
<?php
}
}
?>
</td>
</tr>
<!-- ##################################### End newalias.php ################################## -->