Interface de gestion des catchall, premiet jet
Maintenant, faut remplir les fonctions
This commit is contained in:
parent
e2620c9496
commit
4c206de62d
|
@ -289,6 +289,7 @@ bureau/admin/mail_doadd.php -text
|
|||
bureau/admin/mail_doedit.php -text
|
||||
bureau/admin/mail_edit.php -text
|
||||
bureau/admin/mail_list.php -text
|
||||
bureau/admin/mail_manage_catchall.php -text
|
||||
bureau/admin/mail_undelete.php -text
|
||||
bureau/admin/main.php -text
|
||||
bureau/admin/mem_admin.php -text
|
||||
|
|
|
@ -59,18 +59,31 @@ if ($fatal) {
|
|||
echo "<div class=\"error\">$error</div>";
|
||||
} else {
|
||||
|
||||
?>
|
||||
<table><tr>
|
||||
<?php
|
||||
// Mail creation form
|
||||
if ($quota->cancreate("mail")) {
|
||||
?>
|
||||
<td>
|
||||
<h3><?php __("Create a new mail account");?></h3>
|
||||
<form method="post" action="mail_doadd.php" id="main" name="mail_create">
|
||||
<input type="text" class="int intleft" style="text-align: right" name="mail_arg" value="<?php ehe($mail_arg); ?>" size="32" id="mail_arg" maxlength="255" /><span id="emaildom" class="int intright"><?php echo "@".$domain; ?></span>
|
||||
<input type="hidden" name="domain_id" value="<?php echo $domain_id;?>" />
|
||||
<input type="submit" name="submit" class="inb" value="<?php __("Create this email address"); ?>" />
|
||||
<?php }?>
|
||||
<span class="inb"><a href="mail_manage_catchall.php?domain_id=<?php echo $domain_id?>"><?php __("Manage Catch-all for this domain");?></a></span>
|
||||
<?php if ($quota->cancreate("mail")) { ?>
|
||||
</form>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<td valign=bottom>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if (empty($mails_list)) {
|
||||
echo "<p><i>";
|
||||
__("No mails for this domain.");
|
||||
|
@ -163,8 +176,8 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
|
|||
<?php
|
||||
} } // end if no mail for this domain
|
||||
?>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h3><?php __("Mails configuration informations");?></h3>
|
||||
|
||||
<?php __("Here are some configuration informations you'll need to configure your mail application.");?>
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/*
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2000-2012 by the AlternC Development Team.
|
||||
https://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Purpose of file: Manage catch-all
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
include_once("head.php");
|
||||
|
||||
$fields = array (
|
||||
"domain_id" => array("get","integer",null),
|
||||
"target_type" => array("post", "string", null),
|
||||
"target_mail" => array("post", "string", null),
|
||||
"target_domain" => array("post", "string", null),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
if (is_null($domain_id)) {
|
||||
echo "<p class=\"error\">";
|
||||
__("Problem with the domain");
|
||||
echo"</p>";
|
||||
include_once("foot.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!is_null($target_type)) {
|
||||
switch ($target_type) {
|
||||
case "none":
|
||||
$mail->catchall_del($domain_id);
|
||||
break;
|
||||
case "domain":
|
||||
$mail->catchall_set($domain_id, $target_domain);
|
||||
break;
|
||||
case "mail":
|
||||
$mail->catchall_set($domain_id, $target_mail);
|
||||
break;
|
||||
default:
|
||||
$error=_("Unknow target type");
|
||||
}
|
||||
}
|
||||
|
||||
$catch=$mail->catchall_getinfos($domain_id);
|
||||
printvar($catch);
|
||||
|
||||
?>
|
||||
<h3><?php printf(_("Manage catch-all configuration of %s"),$catch["domain"]); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
if (isset($error)) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
}
|
||||
|
||||
__("You can choose what to do with emails send to unexisting address of this domain");
|
||||
?>
|
||||
<br/><br/>
|
||||
|
||||
<form action="mail_manage_catchall.php?domain_id=<?php echo $domain_id;?>" method="post" name="main" id="main">
|
||||
<table class="tedit">
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><b><?php __("No catch-all");?></b></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=1px><input type="radio" name="target_type" id='target_type_none' value="none" <?php if ($catch['type']=='none') {echo 'checked';}?> /></td>
|
||||
<td colspan=2 style="width: 50%; text-align: justify"><label for='target_type_none'/><?php echo __("No catch-all for this domain.");?></label></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><b><?php __("Redirect to same address on a different domain");?></b></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=1px><input type="radio" name="target_type" id='target_type_domain' value="domain" <?php if ($catch['type']=='domain') {echo 'checked';}?> />
|
||||
<td style="width: 50%; text-align: justify"><label for='target_type_domain'/><?php echo sprintf(_("Mails send to john.doe@%s will be redirect to john.doe@anotherdomain.tld"),$catch['domain']);?></label></td>
|
||||
<td>
|
||||
<p>
|
||||
<input type="text" id="target_domain" name="target_domain" value="<?php if($catch['type']=='domain') { echo $catch['target']; } ?>" placeholder="example.tld" />
|
||||
<ul>
|
||||
<?php foreach ( $dom->enum_domains() as $d) { echo "<li><a href=\"javascript:set_target_domain_value('".addslashes($d)."');\">$d</a></li>"; } ?>
|
||||
</ul>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="3"><b><?php __("Redirect to a specifig email");?></b></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=1px><input type="radio" name="target_type" id='target_type_mail' value="mail" <?php if ($catch['type']=='mail') {echo 'checked';}?> />
|
||||
<td style="width: 50%; text-align: justify"><label for='target_type_mail'/><?php echo sprintf(_("Mails send to an unexisting email on '@%s' will be redirect to user@example.tld."),$catch['domain']);?></label></td>
|
||||
<td>
|
||||
<p>
|
||||
<input type="text" name="target_mail" value="<?php if($catch['type']=='mail') { echo $catch['target']; } ?>" placeholder="john.doe@example.tld" />
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan=3 >
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" />
|
||||
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="window.history.go(-1);"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
function set_target_domain_value(value) {
|
||||
$('#target_domain').val(value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include_once("foot.php"); ?>
|
|
@ -33,13 +33,13 @@ class m_debug_alternc {
|
|||
function m_debug_alternc() {
|
||||
if ( isset($_COOKIE['alternc_debugme']) && $_COOKIE['alternc_debugme'] ) {
|
||||
$this->status=true;
|
||||
ini_set('display_errors', true);
|
||||
}
|
||||
}
|
||||
|
||||
function activate() {
|
||||
setcookie('alternc_debugme',true, time()+3600); // expire in 1 hour
|
||||
$this->status="";
|
||||
ini_set('display_errors', true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,42 @@ class m_mail {
|
|||
$this->srv_pop3s = variable_get('mail_human_pop3s', $L_FQDN,'Human name for POP3s mail server');
|
||||
}
|
||||
|
||||
|
||||
// FIXME documenter
|
||||
function catchall_getinfos($domain_id) {
|
||||
global $dom, $db;
|
||||
$rr=array(
|
||||
'domain' =>$dom->get_domain_byid($domain_id),
|
||||
'target' => '',
|
||||
'type' => '',
|
||||
);
|
||||
|
||||
$db->query("select r.recipients as dst from address a, recipient r where a.domain_id = $domain_id and r.address_id = a.id and a.address='';");
|
||||
if ($db->next_record()) {
|
||||
$rr['target'] = $db->f('dst');
|
||||
}
|
||||
|
||||
// Does it redirect to a specific mail or to a domain
|
||||
if (empty($rr['target'])) {
|
||||
$rr['type']='none';
|
||||
} elseif (substr($rr['target'],0,1)=='@') {
|
||||
$rr['type']='domain';
|
||||
} else {
|
||||
$rr['type']='mail';
|
||||
}
|
||||
|
||||
return $rr;
|
||||
}
|
||||
|
||||
function catchall_del($domain_id) {
|
||||
//FIXME
|
||||
print("catchall_del $domain_id");
|
||||
}
|
||||
|
||||
function catchall_set($domain_id, $target) {
|
||||
//FIXME
|
||||
print("catchall_set $domain_id $target");
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** get_quota (hook for quota class), returns the number of used
|
||||
|
|
Loading…
Reference in New Issue