root/trunk/gui/reseller/alias_delete.php

Revision 1414, 2.5 kB (checked in by scitech, 6 hours ago)

Alias subdomain are not deleted when alais is deleted in same operation. Alias subdomains are not counted. Add support for alias subdomain mail (part III)

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 require '../include/ispcp-lib.php';
22
23 check_login(__FILE__);
24
25 $theme_color = Config::get('USER_INITIAL_THEME');
26
27 if (isset($_GET['del_id']))
28     $del_id = $_GET['del_id'];
29 else {
30     $_SESSION['aldel'] = '_no_';
31     header("Location: alias.php");
32     die();
33 }
34 $reseller_id = $_SESSION['user_id'];
35
36 $query = <<<SQL_QUERY
37     select
38         t1.domain_id, t1.alias_id, t1.alias_name, t2.domain_id, t2.domain_created_id
39     from
40         domain_aliasses as t1,
41         domain as t2
42     where
43             t1.alias_id = ?
44         and
45             t1.domain_id = t2.domain_id
46         and
47             t2.domain_created_id = ?
48 SQL_QUERY;
49
50 $rs = exec_query($sql, $query, array($del_id, $reseller_id));
51
52 if ($rs->RecordCount() == 0) {
53     header('Location: alias.php');
54     die();
55 }
56
57 $alias_name = $rs->fields['alias_name'];
58 $delete_status = Config::get('ITEM_DELETE_STATUS');
59
60 /* check for mail acc in ALIAS domain (ALIAS MAIL) and delete them */
61 $query = <<<SQL_QUERY
62     update
63         mail_users
64     set
65         status = ?
66     WHERE
67         (`sub_id` = ?
68         AND
69         `mail_type` LIKE '%alias_%')
70     OR
71         (`sub_id` IN (SELECT `subdomain_alias_id` FROM `subdomain_alias` WHERE `alias_id`=?)
72         AND
73         `mail_type` LIKE '%alssub_%')
74
75         
76 SQL_QUERY;
77
78 $rs = exec_query($sql, $query, array($delete_status, $del_id, $del_id));
79
80 while (!$rs->EOF) {
81     $rs->MoveNext();
82 }
83
84 $res = exec_query($sql, "select alias_name from domain_aliasses where alias_id=?", array($del_id));
85 $dat = $res->FetchRow();
86
87 exec_query($sql, "update subdomain_alias set subdomain_alias_status='" . Config::get('ITEM_DELETE_STATUS') . "' where alias_id=?", array($del_id));
88 exec_query($sql, "update domain_aliasses set alias_status='" . Config::get('ITEM_DELETE_STATUS') . "' where alias_id=?", array($del_id));
89 send_request();
90 $admin_login = $_SESSION['user_logged'];
91 write_log("$admin_login: deletes domain alias: " . $dat['alias_name']);
92
93 $_SESSION['aldel'] = '_yes_';
94 header("Location: alias.php");
95 die()
96
97 ?>
Note: See TracBrowser for help on using the browser.