26 require_once(
"../class/config.php");
27 include_once(
"head.php");
30 "domain_id" => array(
"request",
"integer",
null),
31 "target_type" => array(
"post",
"string",
null),
32 "target_mail" => array(
"post",
"string",
null),
33 "target_domain" => array(
"post",
"string",
null),
37 if (is_null($domain_id)) {
38 $msg->raise(
"ERROR",
"mail", _(
"Problem with the domain"));
39 include_once(
"mail_list.php");
43 if (!is_null($target_type)) {
44 switch ($target_type) {
46 if ($mail->catchall_del($domain_id))
47 $msg->raise(
"INFO",
"mail", _(
"Catchall successfully deleted"));
49 require_once(
"mail_list.php");
53 if ($mail->catchall_set($domain_id, $target_domain)) {
54 $msg->raise(
"INFO",
"mail", _(
"Catchall successfully updated"));
55 require_once(
"mail_list.php");
60 if ($mail->catchall_set($domain_id, $target_mail)) {
61 $msg->raise(
"INFO",
"mail", _(
"Catchall successfully updated"));
62 require_once(
"mail_list.php");
67 $error=_(
"Unknown target type");
71 $catch=$mail->catchall_getinfos($domain_id);
74 <h3><?php printf(_(
"Manage catch-all configuration of %s"),
$catch[
"domain"]); ?></h3>
79 echo
$msg->msg_html_all();
81 __(
"You can choose what to do with emails sent to unexisting address of this domain");
85 <form action=
"mail_manage_catchall.php?domain_id=<?php echo $domain_id;?>" method=
"post" name=
"main" id=
"main">
90 <th colspan=
"3"><b><?php
__(
"No catch-all");?></b></th>
93 <td width=
"1px"><input type=
"radio" name=
"target_type" id=
'target_type_none' value=
"none" <?php
if (
$catch[
'type']==
'none') {echo
'checked="checked"';}?> /></td>
94 <td colspan=
'2' style=
"width: 50%; text-align: justify"><label
for=
'target_type_none'><?php echo
__(
"No catch-all for this domain.");?></label></td>
98 <th colspan=
"3"><b><?php
__(
"Redirect to same address on a different domain");?></b></th>
101 <td width=
"1px"><input type=
"radio" name=
"target_type" id=
'target_type_domain' value=
"domain" <?php
if (
$catch[
'type']==
'domain') {echo
'checked="checked"';}?> /></td>
102 <td style=
"width: 50%; text-align: justify"><label
for=
'target_type_domain'><?php echo sprintf(_(
"Mails sent to john.doe@%s will be redirect to john.doe@anotherdomain.tld"),
$catch[
'domain']);?></label></td>
105 <i><?php
__(
"Enter the 'target' domain"); ?></i><br/>
106 <input type=
"text" id=
"target_domain" name=
"target_domain" value=
"<?php if($catch['type']=='domain') { ehe(substr($catch['target'],1)); } ?>" placeholder=
"<?php __("example.tld
");?>" />
108 <i><?php
__(
"Or choose one of your own"); ?></i>
110 <?php
foreach (
$dom->enum_domains() as
$d) {
if (
$d==
$catch[
'domain']) {
continue;} echo
"<li><a href=\"javascript:set_target_domain_value('".addslashes(
$d).
"');\">$d</a></li>"; } ?>
116 <th colspan=
"3"><b><?php
__(
"Redirect to a specific email");?></b></th>
119 <td width=
"1px"><input type=
"radio" name=
"target_type" id=
'target_type_mail' value=
"mail" <?php
if (
$catch[
'type']==
'mail') { echo
'checked="checked"'; } ?> /></td>
120 <td style=
"width: 50%; text-align: justify"><label
for=
'target_type_mail'><?php echo sprintf(_(
"Mails sent to an unexisting email on '@%s' will be redirect to user@example.tld."),
$catch[
'domain']);?></label></td>
123 <input type=
"text" name=
"target_mail" size=
"30" value=
"<?php if($catch['type']=='mail') { ehe($catch['target']); } ?>" placeholder=
"<?php __("john.doe@example.tld
");?>" />
131 <input type=
"submit" class=
"inb" name=
"submit" value=
"<?php __("Save
"); ?>" />
132 <input type=
"button" class=
"inb" name=
"cancel" value=
"<?php __("Cancel
"); ?>" onclick=
"window.history.go(-1);"/>
136 <script type=
"text/javascript">
137 function set_target_domain_value(value) {
138 $(
'#target_domain').val(value);
139 $(
'#target_type_domain').prop(
'checked',
true);
143 <?php include_once(
"foot.php"); ?>
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
if(is_null($domain_id)) if(!is_null($target_type)) $catch
$fields
Manages the catch-all account of a domain for a user.