Skip to content

Commit 1426f3f

Browse files
committed
Update epp.php
1 parent 1100bd6 commit 1426f3f

File tree

1 file changed

+34
-71
lines changed

1 file changed

+34
-71
lines changed

epp.php

Lines changed: 34 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -171,73 +171,41 @@ function epp_RegisterDomain($params = array())
171171
'tech',
172172
'billing'
173173
) as $i => $contactType) {
174+
// contact:create
174175
$from = $to = array();
175176
$from[] = '/{{ id }}/';
176-
$id = strtoupper($params['registrarprefix'] . '-' . $contactType . '' . $params['domainid']);
177-
$to[] = htmlspecialchars($id);
177+
$to[] = strtoupper($s->generateRandomString());
178+
$from[] = '/{{ name }}/';
179+
$to[] = htmlspecialchars($params['firstname'] . ' ' . $params['lastname']);
180+
$from[] = '/{{ org }}/';
181+
$to[] = htmlspecialchars($params['companyname']);
182+
$from[] = '/{{ street1 }}/';
183+
$to[] = htmlspecialchars($params['address1']);
184+
$from[] = '/{{ street2 }}/';
185+
$to[] = htmlspecialchars($params['address2']);
186+
$from[] = '/{{ street3 }}/';
187+
$street3 = (isset($params['address3']) ? $params['address3'] : '');
188+
$to[] = htmlspecialchars($street3);
189+
$from[] = '/{{ city }}/';
190+
$to[] = htmlspecialchars($params['city']);
191+
$from[] = '/{{ state }}/';
192+
$to[] = htmlspecialchars($params['state']);
193+
$from[] = '/{{ postcode }}/';
194+
$to[] = htmlspecialchars($params['postcode']);
195+
$from[] = '/{{ country }}/';
196+
$to[] = htmlspecialchars($params['country']);
197+
$from[] = '/{{ phonenumber }}/';
198+
$to[] = htmlspecialchars($params['fullphonenumber']);
199+
$from[] = '/{{ email }}/';
200+
$to[] = htmlspecialchars($params['email']);
201+
$from[] = '/{{ authInfo }}/';
202+
$to[] = htmlspecialchars($s->generateObjectPW());
178203
$from[] = '/{{ clTRID }}/';
179204
$clTRID = str_replace('.', '', round(microtime(1), 3));
180-
$to[] = htmlspecialchars($params['registrarprefix'] . '-contact-check-' . $clTRID); // vezi la create tot acest id sa fie
205+
$to[] = htmlspecialchars($params['registrarprefix'] . '-contact-create-' . $clTRID);
206+
$from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims";
207+
$to[] = '';
181208
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
182-
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
183-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
184-
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
185-
<command>
186-
<check>
187-
<contact:check
188-
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
189-
xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd">
190-
<contact:id>{{ id }}</contact:id>
191-
</contact:check>
192-
</check>
193-
<clTRID>{{ clTRID }}</clTRID>
194-
</command>
195-
</epp>');
196-
$r = $s->write($xml, __FUNCTION__);
197-
$r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->chkData;
198-
199-
// $reason = (string)$r->cd[0]->reason;
200-
// if (!$reason) {
201-
// $reason = 'Contact is not available';
202-
// }
203-
204-
if (1 == (int)$r->cd[0]->id->attributes()->avail) {
205-
206-
// contact:create
207-
$from = $to = array();
208-
$from[] = '/{{ id }}/';
209-
$to[] = strtoupper($s->generateRandomString());
210-
$from[] = '/{{ name }}/';
211-
$to[] = htmlspecialchars($params['firstname'] . ' ' . $params['lastname']);
212-
$from[] = '/{{ org }}/';
213-
$to[] = htmlspecialchars($params['companyname']);
214-
$from[] = '/{{ street1 }}/';
215-
$to[] = htmlspecialchars($params['address1']);
216-
$from[] = '/{{ street2 }}/';
217-
$to[] = htmlspecialchars($params['address2']);
218-
$from[] = '/{{ street3 }}/';
219-
$street3 = (isset($params['address3']) ? $params['address3'] : '');
220-
$to[] = htmlspecialchars($street3);
221-
$from[] = '/{{ city }}/';
222-
$to[] = htmlspecialchars($params['city']);
223-
$from[] = '/{{ state }}/';
224-
$to[] = htmlspecialchars($params['state']);
225-
$from[] = '/{{ postcode }}/';
226-
$to[] = htmlspecialchars($params['postcode']);
227-
$from[] = '/{{ country }}/';
228-
$to[] = htmlspecialchars($params['country']);
229-
$from[] = '/{{ phonenumber }}/';
230-
$to[] = htmlspecialchars($params['fullphonenumber']);
231-
$from[] = '/{{ email }}/';
232-
$to[] = htmlspecialchars($params['email']);
233-
$from[] = '/{{ authInfo }}/';
234-
$to[] = htmlspecialchars($s->generateObjectPW());
235-
$from[] = '/{{ clTRID }}/';
236-
$clTRID = str_replace('.', '', round(microtime(1), 3));
237-
$to[] = htmlspecialchars($params['registrarprefix'] . '-contact-create-' . $clTRID);
238-
$from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims";
239-
$to[] = '';
240-
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
241209
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
242210
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
243211
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
@@ -270,14 +238,9 @@ function epp_RegisterDomain($params = array())
270238
<clTRID>{{ clTRID }}</clTRID>
271239
</command>
272240
</epp>');
273-
$r = $s->write($xml, __FUNCTION__);
274-
$r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->creData;
275-
$contacts[$i + 1] = $r->id;
276-
}
277-
else {
278-
$id = strtoupper($params['registrarprefix'] . '-' . $contactType . '' . $params['domainid']);
279-
$contacts[$i + 1] = htmlspecialchars($id);
280-
}
241+
$r = $s->write($xml, __FUNCTION__);
242+
$r = $r->response->resData->children('urn:ietf:params:xml:ns:contact-1.0')->creData;
243+
$contacts[$i + 1] = $r->id;
281244
}
282245

283246
foreach(array(
@@ -2145,4 +2108,4 @@ function (Blueprint $table)
21452108
}
21462109
}
21472110

2148-
?>
2111+
?>

0 commit comments

Comments
 (0)