Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootinc/r01.inc.php
Строк: 255
<?
class R01
{
public $controller = true;
public $url = null;
public $port = null;
public $user = null;
public $password = null;
public $error = null;
public $client = null;
public $isConnected = false;
public function startup(&$controller)
{
$this->controller =& $controller;
}
public function init($url,$port,$user,$password)
{
$this->user = $user;
$this->url = $url;
$this->port = $port;
$this->password = $password;
}
public function logIn()
{
ini_set('soap.wsdl_cache_enabled', 0);
# ini_set('session.name', 'SOAPClient');
$this->client = new SoapClient(null,array
(
'location' => "https://".$this->url.":".$this->port."/partner_api.khtml",
'uri' => 'urn:RegbaseSoapInterface',
'exceptions' => false,
'user_agent' => 'RegbaseSoapInterfaceClient',
'trace' => 1
)
);
$result = $this->client->logIn($this->user,$this->password);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
$this->client->__setCookie('SOAPClient',$result->status->message);
$this->isConnected = true;
return true;
} else {
$this->error = "logIn: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
return false;
}
} else {
$this->error = "logIn: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
}
public function logOut()
{
if ($this->isConnected) {
$result = $this->client->logOut();
if (!is_soap_fault($result)) {
$this->isConnected = false;
return true;
} else {
# $this->error = "logOut: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
}
}
public function createContactPerson($nic_hdl, $fiorus, $fioeng, $passport, $birth_date, $postal_addr, $phone, $fax, $e_mail, $isprotected, $isresident)
{
if ($this->isConnected or $this->logIn()) {
$result = $this->client->addDadminPerson($nic_hdl, $fiorus, $fioeng, htmlDecode($passport), $birth_date, htmlDecode($postal_addr), $phone, $fax, $e_mail, $isprotected, $isresident);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
return $result->nic_hdl;
} else {
$this->error = "createContactPerson: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
$this->logOut();
return false;
}
} else {
$this->error = "createContactPerson: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
} else {
return false;
}
}
public function createContactOrg($nic_hdl, $orgname_ru, $orgname_en, $inn, $kpp, $ogrn, $legal_addr, $postal_addr, $phone, $fax, $e_mail, $director_name, $bank, $ras_schet, $kor_schet, $bik, $isresident)
{
if ($this->isConnected or $this->logIn()) {
$result = $this->client->addDadminOrg($nic_hdl, htmlDecode($orgname_ru), htmlDecode($orgname_en), $inn, $kpp, $ogrn, htmlDecode($legal_addr), htmlDecode($postal_addr), $phone, $fax, $e_mail, $director_name, htmlDecode($bank), $ras_schet, $kor_schet, $bik, $isresident);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
return $result->nic_hdl;
} else {
$this->error = "createContactOrg: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
$this->logOut();
return false;
}
} else {
$this->error = "createContactOrg: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
} else {
return false;
}
}
public function registerDomain($domain,$ns1,$ns2,$ns3,$ns4,$nicHandle,$desc)
{
$nsservers = "$ns1n$ns2";
if ($ns3) {$nsservers=$nsservers."n$ns3";}
if ($ns4) {$nsservers=$nsservers."n$ns4";}
if ($this->isConnected or $this->logIn()) {
$result = $this->client->addDomain($domain,$nsservers,$nicHandle,$desc);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
$this->logOut();
return $result->domain_taskid;
} else {
$this->error = "registerDomain: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
$this->logOut();
return false;
}
} else {
$this->error = "registerDomain: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
} else {
return false;
}
}
public function renewDomain($domain)
{
if ($this->isConnected or $this->logIn()) {
$result = $this->client->prolongDomain($domain);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
$this->logOut();
return $result->domain_taskid;
} else {
$this->error = "renewDomain: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
$this->logOut();
return false;
}
} else {
$this->error = "renewDomain: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
} else {
return false;
}
}
public function getNS($domain)
{
$d = new domain($domain);
$result = $d->info();
if (!$d->last_error) {
$result1 = mb_split("n", $result);
while (list($index,$res) = each($result1)) {
if (preg_match("/nserver/ui",$res)) {
preg_match("/nserver:s+(.*)/iu",$res,$arr);
$resultarray[]=$arr[1];
} else if (preg_match("/Name Server/ui",$res)) {
preg_match("/Name Server:s+(.*)/iu",$res,$arr);
$resultarray[]=$arr[1];
}
}
return $resultarray;
} else {
$this->error = "getNS: $d->last_error";;
return false;
}
}
public function updateNS($domain,$ns1,$ns2,$ns3,$ns4,$nicHandle)
{
$nsservers = "$ns1n$ns2";
if ($ns3) {$nsservers=$nsservers."n$ns3";}
if ($ns4) {$nsservers=$nsservers."n$ns4";}
if ($this->isConnected or $this->logIn()) {
$result = $this->client->updateDomain($domain,$nsservers,$nicHandle);
if (!is_soap_fault($result)) {
if ($result->status->code == '1') {
$this->logOut();
return $result->domain_taskid;
} else {
$this->error = "updateNS: Code ".$result->status->code.", ".$result->status->name." (".$result->status->message.")";
$this->logOut();
return false;
}
} else {
$this->error = "updateNS: SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})";
return false;
}
} else {
return false;
}
}
}
?>