domain.php
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/*
	[UCenter] (C)2001-2099 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms
	$Id: domain.php 1139 2012-05-08 09:02:11Z liulanbo $
*/
!defined('IN_UC') && exit('Access Denied');
class control extends adminbase {
	function __construct() {
		$this->control();
	}
	function control() {
		parent::__construct();
		$this->check_priv();
		if(!$this->user['isfounder'] && !$this->user['allowadmindomain']) {
			$this->message('no_permission_for_this_module');
		}
		$this->load('domain');
		$this->load('misc');
		$this->check_priv();
	}
	function onls() {
		$status = 0;
		if(@$_POST['domainnew']) {
			if(!$_ENV['misc']->check_ip($_POST['ipnew'])) {
				$this->message('app_add_ip_invalid', 'BACK');
			}
			$_ENV['domain']->add_domain($_POST['domainnew'], $_POST['ipnew']);
			$status = 1;
			$this->writelog('domain_add', 'domainnew='.dhtmlspecialchars($_POST['domainnew']).'&ipnew='.dhtmlspecialchars($_POST['ipnew']));
		}
		if(@$_POST['domain']) {
			foreach($_POST['domain'] as $id => $arr) {
				if(!$_ENV['misc']->check_ip($_POST['ip'][$id])) {
					$this->message('app_add_ip_invalid', 'BACK');
				}
				$_ENV['domain']->update_domain($_POST['domain'][$id], $_POST['ip'][$id], $id);
			}
			$status = 2;
		}
		if(@$_POST['delete']) {
			$_ENV['domain']->delete_domain($_POST['delete']);
			$status = 2;
			$this->writelog('domain_delete', "delete=".implode(',', $_POST['delete']));
		}
		if($status > 0) {
			$notedata = $_ENV['domain']->get_list($_GET['page'], 1000000, 1000000);
			$this->load('note');
			$_ENV['note']->add('updatehosts', '', $this->serialize($notedata));
			$_ENV['note']->send();
		}
		$num = $_ENV['domain']->get_total_num();
		$domainlist = $_ENV['domain']->get_list($_GET['page'], UC_PPP, $num);
		$multipage = $this->page($num, UC_PPP, $_GET['page'], 'admin.php?m=domain&a=ls');
		$this->view->assign('status', $status);
		$this->view->assign('domainlist', $domainlist);
		$this->view->assign('multipage', $multipage);
		$this->view->display('admin_domain');
	}
}
?>