From 4c206de62dcb99c5601d8c77562302d6928bc9ef Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Sat, 20 Oct 2012 13:16:14 +0000 Subject: [PATCH] Interface de gestion des catchall, premiet jet Maintenant, faut remplir les fonctions --- .gitattributes | 1 + bureau/admin/mail_list.php | 17 +++- bureau/admin/mail_manage_catchall.php | 132 ++++++++++++++++++++++++++ bureau/class/m_debug_alternc.php | 2 +- bureau/class/m_mail.php | 37 +++++++- 5 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 bureau/admin/mail_manage_catchall.php diff --git a/.gitattributes b/.gitattributes index e7859ea7..f04bcd30 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/bureau/admin/mail_list.php b/bureau/admin/mail_list.php index d7d1d2ec..ad77d00d 100644 --- a/bureau/admin/mail_list.php +++ b/bureau/admin/mail_list.php @@ -59,18 +59,31 @@ if ($fatal) { echo "
$error
"; } else { +?> + +cancreate("mail")) { ?> + + + +

" /> + + +cancreate("mail")) { ?>
+
+
+"; __("No mails for this domain."); @@ -163,8 +176,8 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"] -
+

diff --git a/bureau/admin/mail_manage_catchall.php b/bureau/admin/mail_manage_catchall.php new file mode 100644 index 00000000..121acef3 --- /dev/null +++ b/bureau/admin/mail_manage_catchall.php @@ -0,0 +1,132 @@ + 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 "

"; + __("Problem with the domain"); + echo"

"; + 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); + +?> +

+
+
+ +$error

"; +} + +__("You can choose what to do with emails send to unexisting address of this domain"); +?> +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/>
/> + +

+ +

    + enum_domains() as $d) { echo "
  • $d
  • "; } ?> +
+

+
/> + +

+ +

+
+ " /> + " onclick="window.history.go(-1);"/> +
+
+ + + diff --git a/bureau/class/m_debug_alternc.php b/bureau/class/m_debug_alternc.php index 3d42438c..771b4e34 100644 --- a/bureau/class/m_debug_alternc.php +++ b/bureau/class/m_debug_alternc.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; } diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php index 6561bb08..70e93f89 100644 --- a/bureau/class/m_mail.php +++ b/bureau/class/m_mail.php @@ -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