domain.php 2.0 KB

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