root/trunk/gui/client/mail_autoresponder_disable.php

Revision 1412, 2.8 kB (checked in by scitech, 44 minutes ago)

Fixed #1518: Virtual mail problem. Add support for alias subdomain mail (part I)

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21
22 require '../include/ispcp-lib.php';
23
24 check_login(__FILE__);
25
26 function check_email_user(&$sql) {
27     $dmn_name = $_SESSION['user_logged'];
28     $mail_id = $_GET['id'];
29
30     $query = "
31         select
32           t1.*,
33           t2.domain_id,
34           t2.domain_name
35         from
36           mail_users as t1,
37           domain as t2
38         where
39           t1.mail_id = ?
40         and
41           t2.domain_id = t1.domain_id
42         and
43           t2.domain_name = ?
44 ";
45
46       $rs = exec_query($sql, $query, array($mail_id, $dmn_name));
47       $mail_acc = $rs->fields['mail_acc'];
48
49       if ($rs -> RecordCount() == 0) {
50         set_page_message(tr('User does not exist or you do not have permission to access this interface!'));
51         header('Location: mail_accounts.php');
52         die();
53       }
54 }
55
56 check_email_user($sql);
57
58 if (isset($_GET['id']) && $_GET['id'] !== '') {
59     $mail_id = $_GET['id'];
60     $item_change_status = Config::get('ITEM_CHANGE_STATUS');
61     check_for_lock_file();
62
63     $query = "
64         update
65             mail_users
66         set
67             status = ?,
68             mail_auto_respond = 0
69         where
70             mail_id = ?
71     ";
72
73       $rs = exec_query($sql, $query, array($item_change_status, $mail_id));
74
75     send_request();
76     $query = "
77         SELECT
78             `mail_type`,
79             IF(`mail_type` like 'normal_%',t2.`domain_name`,
80                 IF(`mail_type` like 'alias_%',t3.`alias_name`,
81                     IF(`mail_type` like 'subdom_%',CONCAT(t4.`subdomain_name`,'.',t6.`domain_name`),CONCAT(t5.`subdomain_alias_name`,'.',t7.`alias_name`))
82                 )
83             ) AS mailbox
84         FROM
85             `mail_users` as t1
86         left join (domain as t2) on (t1.domain_id=t2.domain_id)
87         left join (domain_aliasses as t3) on (sub_id=alias_id)
88         left join (subdomain as t4) on (sub_id=subdomain_id)
89         left join (subdomain_alias as t5) on (sub_id=subdomain_alias_id)
90         left join (domain as t6) on (t4.domain_id=t6.domain_id)
91         left join (domain_aliasses as t7) on (t5.alias_id=t7.alias_id)
92         WHERE
93             `mail_id` = ?
94     ";
95
96     $rs = exec_query($sql, $query, array($mail_id));
97     $mail_name = $rs->fields['mailbox'];
98     write_log($_SESSION['user_logged'].": disabled mail autoresponder: ".$mail_name);
99     set_page_message(tr('Mail account scheduled for modification!'));
100     header('Location: mail_accounts.php');
101     exit(0);
102 }
103 else {
104       header('Location: mail_accounts.php');
105       exit(0);
106 }
107
108 ?>
109
Note: See TracBrowser for help on using the browser.