1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AfriCC\EPP\Extension\NASK\Update; |
4
|
|
|
|
5
|
|
|
use AfriCC\EPP\ExtensionInterface; |
6
|
|
|
use AfriCC\EPP\Frame\Command\Update\Domain as DomainUpdate; |
7
|
|
|
use AfriCC\EPP\Validator; |
8
|
|
|
|
9
|
|
|
class Domain extends DomainUpdate implements ExtensionInterface |
10
|
|
|
{ |
11
|
|
|
protected $extension = 'extdom'; |
12
|
|
|
|
13
|
|
|
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extdom-2.0'; |
14
|
|
|
|
15
|
|
|
public function getExtensionNamespace() |
16
|
|
|
{ |
17
|
|
|
return $this->extension_xmlns; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function addNs($host, $remove = false) |
21
|
|
|
{ |
22
|
|
|
if (!Validator::isHostname($host)) { |
23
|
|
|
throw new \Exception(sprintf('%s is not a valid host name', $host)); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
if ($remove) { |
27
|
|
|
$key = 'rem'; |
28
|
|
|
} else { |
29
|
|
|
$key = 'add'; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$this->set(sprintf('domain:%s/domain:ns[]', $key), $host); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function removeNs($host) |
36
|
|
|
{ |
37
|
|
|
return $this->addNs($host, true); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function addHostObj($host, $remove = false) |
41
|
|
|
{ |
42
|
|
|
return $this->addNs($host, $remove); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function addAdminContact($contact, $remove = false) |
46
|
|
|
{ |
47
|
|
|
if ($remove) { |
48
|
|
|
$key = 'rem'; |
49
|
|
|
} else { |
50
|
|
|
return false; //TODO: should this thow if registry forbids adding Admin contact? |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$this->set(sprintf('domain:%s/domain:contact[@type=\'admin\']', $key), $contact); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function addTechContact($contact, $remove = false) |
57
|
|
|
{ |
58
|
|
|
if ($remove) { |
59
|
|
|
$key = 'rem'; |
60
|
|
|
} else { |
61
|
|
|
return false; //TODO: shuld this throw if registry forbids adding Tech contact? |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
$this->set(sprintf('domain:%s/domain:contact[@type=\'tech\']', $key), $contact); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function addBillingContact($contact, $remove = false) |
68
|
|
|
{ |
69
|
|
|
if ($remove) { |
70
|
|
|
$key = 'rem'; |
71
|
|
|
} else { |
72
|
|
|
return false; //TODO: should this throw if registry forbids adding Billing contact |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$this->set(sprintf('domain:%s/domain:contact[@type=\'billing\']', $key), $contact); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|