[Make replication of ngnpro requests for dns and enum ports generic Adrian Georgescu **20081105151653] hunk ./library/ngnpro_client.php 1440 + function initRemoteReplicationEngine($reseller) { + if (!$reseller) return false; + if (!$this->remote_engine_name) return false; + + dprint_r($this->SoapEngine->login_credentials['reseller_filters'][$reseller]); + + $remote_engine=$this->SoapEngine->login_credentials['reseller_filters'][$reseller][$this->remote_engine_name]; + + if (!strlen($remote_engine)) { + return false; + } + + if ($this->SoapEngine->soapEngine == $remote_engine) { + return false; + } + + if (!in_array($remote_engine,array_keys($this->SoapEngine->soapEngines))) { + return false; + } + + $this->SOAPloginRemote = array( + "username" => $this->SoapEngine->soapEngines[$remote_engine]['username'], + "password" => $this->SoapEngine->soapEngines[$remote_engine]['password'], + "admin" => true, + "impersonate" => intval($reseller) + ); + + $this->SOAPurlRemote=$this->SoapEngine->soapEngines[$remote_engine]['url']; + + $log=sprintf ("and syncronize changes to %s",$this->SOAPurlRemote,$this->SOAPurlRemote); + dprint($log); + + $this->SoapAuthRemote = array('auth', $this->SOAPloginRemote , 'urn:AGProjects:NGNPro', 0, ''); + + $this->SoapEngineRemote = new $this->SoapEngine->soap_class($this->SOAPurlRemote); + + if (strlen($this->soapEngines[$remote_engine]['timeout'])) { + $this->SoapEngineRemote->_options['timeout'] = intval($this->soapEngines[$remote_engine]['timeout']); + } else { + $this->SoapEngineRemote->_options['timeout'] = $this->soapTimeout; + } + + $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0); + $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0); + + return true; + } hunk ./library/ngnpro_client.php 3459 + var $remote_engine_name='enum_engine_remote'; hunk ./library/ngnpro_client.php 3516 - if ($this->reseller) { - dprint_r($this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]); - - $enum_engine_remote=$this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]['enum_engine_remote']; - - if (strlen($enum_engine_remote) && $this->SoapEngine->soapEngine != $enum_engine_remote) { - // replicate change - - if (in_array($enum_engine_remote,array_keys($this->SoapEngine->soapEngines))) { - $this->SOAPloginRemote = array( - "username" => $this->SoapEngine->soapEngines[$enum_engine_remote]['username'], - "password" => $this->SoapEngine->soapEngines[$enum_engine_remote]['password'], - "admin" => true, - "impersonate" => intval($this->reseller) - ); - - //dprint_r($this->SOAPloginRemote); - $this->SOAPurlRemote=$this->SoapEngine->soapEngines[$enum_engine_remote]['url']; - - $log=sprintf ("and syncronize changes to %s",$this->SOAPurlRemote,$this->SOAPurlRemote); - dprint($log); - - $this->SoapAuthRemote = array('auth', $this->SOAPloginRemote , 'urn:AGProjects:NGNPro', 0, ''); - - $this->SoapEngineRemote = new $this->SoapEngine->soap_class($this->SOAPurlRemote); - - if (strlen($this->soapEngines[$enum_engine_remote]['timeout'])) { - $this->SoapEngineRemote->_options['timeout'] = intval($this->soapEngines[$enum_engine_remote]['timeout']); - } else { - $this->SoapEngineRemote->_options['timeout'] = $this->soapTimeout; - } - - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0); - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0); - } - } - } - hunk ./library/ngnpro_client.php 3658 + if ($this->adminonly) $_url.= sprintf ("&reseller_filter=%s",$range->reseller); + hunk ./library/ngnpro_client.php 3699 - hunk ./library/ngnpro_client.php 3806 + if ($this->adminonly) { + $this->initRemoteReplicationEngine($this->filters['reseller']); + } else { + $this->initRemoteReplicationEngine($this->reseller); + } + hunk ./library/ngnpro_client.php 3937 + $this->initRemoteReplicationEngine($reseller); + hunk ./library/ngnpro_client.php 3989 - $result = $this->SoapEngineRemote->addRange($result); + $result = $this->SoapEngineRemote->addRange($range); hunk ./library/ngnpro_client.php 4234 + $this->initRemoteReplicationEngine($range->reseller); + hunk ./library/ngnpro_client.php 4357 + var $remote_engine_name='enum_engine_remote'; + hunk ./library/ngnpro_client.php 4487 - if ($this->reseller) { - dprint_r($this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]); - - $enum_engine_remote=$this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]['enum_engine_remote']; - - if (strlen($enum_engine_remote) && $this->SoapEngine->soapEngine != $enum_engine_remote) { - // replicate change - - if (in_array($enum_engine_remote,array_keys($this->SoapEngine->soapEngines))) { - $this->SOAPloginRemote = array( - "username" => $this->SoapEngine->soapEngines[$enum_engine_remote]['username'], - "password" => $this->SoapEngine->soapEngines[$enum_engine_remote]['password'], - "admin" => true, - "impersonate" => intval($this->reseller) - ); - - $this->SOAPurlRemote=$this->SoapEngine->soapEngines[$enum_engine_remote]['url']; - - $log=sprintf ("and syncronize changes to %s",$this->SOAPurlRemote,$this->SOAPurlRemote); - dprint($log); - - $this->SoapAuthRemote = array('auth', $this->SOAPloginRemote , 'urn:AGProjects:NGNPro', 0, ''); - - $this->SoapEngineRemote = new $this->SoapEngine->soap_class($this->SOAPurlRemote); - - if (strlen($this->soapEngines[$enum_engine_remote]['timeout'])) { - $this->SoapEngineRemote->_options['timeout'] = intval($this->soapEngines[$enum_engine_remote]['timeout']); - } else { - $this->SoapEngineRemote->_options['timeout'] = $this->soapTimeout; - } - - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0); - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0); - } - } - } hunk ./library/ngnpro_client.php 4654 + + if ($this->adminonly) $_url.= sprintf ("&reseller_filter=%s",$number->reseller); hunk ./library/ngnpro_client.php 4675 + if ($this->adminonly) $_number_url.= sprintf ("&reseller_filter=%s",$number->reseller); + hunk ./library/ngnpro_client.php 4812 - + + if ($this->adminonly) $_url.= sprintf ("&reseller_filter=%s",$number->reseller); + hunk ./library/ngnpro_client.php 4831 + if ($this->adminonly) $_number_url.= sprintf ("&reseller_filter=%s",$number->reseller); + hunk ./library/ngnpro_client.php 5044 + if ($this->adminonly) { + $this->initRemoteReplicationEngine($this->filters['reseller']); + } else { + $this->initRemoteReplicationEngine($this->reseller); + } + hunk ./library/ngnpro_client.php 5158 + if ($this->adminonly && !$this->filters['reseller']) return; + hunk ./library/ngnpro_client.php 5172 + + if ($this->adminonly) { + printf (" ",$this->filters['reseller']); + } + hunk ./library/ngnpro_client.php 5212 - print ""; hunk ./library/ngnpro_client.php 5366 - list($customer,$reseller)=$this->customerFromLogin($dictionary); + $this->initRemoteReplicationEngine($reseller); hunk ./library/ngnpro_client.php 5811 + $this->initRemoteReplicationEngine($number->reseller); + hunk ./library/ngnpro_client.php 5926 + var $remote_engine_name='dns_engine_remote'; hunk ./library/ngnpro_client.php 6124 + if ($this->adminonly) $_url.= sprintf ("&reseller_filter=%s",$zone->reseller); + hunk ./library/ngnpro_client.php 6134 - if ($this->adminonly) { - $zone_url=sprintf('%s',$this->url,$this->SoapEngine->service,$zone->reseller,$zone->name,$zone->name); - } else { - $zone_url=sprintf('%s',$this->url,$this->SoapEngine->service,$zone->name,$zone->name); - } - - $customer_url = $this->url.sprintf("&service=customers@%s&customer_filter=%s", - urlencode($this->SoapEngine->customer_engine), - urlencode($zone->customer) + $zone_url=sprintf('%s&service=%s&name_filter=%s', + $this->url, + $this->SoapEngine->service, + $zone->name hunk ./library/ngnpro_client.php 6145 + if ($this->adminonly) $zone_url .= sprintf("&reseller_filter=%s",$zone->reseller); + if ($this->adminonly) $records_url .= sprintf("&reseller_filter=%s",$zone->reseller); + + $customer_url = $this->url.sprintf("&service=customers@%s&customer_filter=%s", + urlencode($this->SoapEngine->customer_engine), + urlencode($zone->customer) + ); + hunk ./library/ngnpro_client.php 6164 - %s + %s hunk ./library/ngnpro_client.php 6179 + $zone->name, hunk ./library/ngnpro_client.php 6224 + if ($this->adminonly) { + $this->initRemoteReplicationEngine($this->filters['reseller']); + } else { + $this->initRemoteReplicationEngine($this->reseller); + } + hunk ./library/ngnpro_client.php 6323 + $this->initRemoteReplicationEngine($reseller); hunk ./library/ngnpro_client.php 6527 + $this->initRemoteReplicationEngine($zone->reseller); + hunk ./library/ngnpro_client.php 6697 + var $remote_engine_name='dns_engine_remote'; hunk ./library/ngnpro_client.php 6952 - if ($this->reseller) { - dprint_r($this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]); - - $dns_engine_remote=$this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]['dns_engine_remote']; - - if (strlen($dns_engine_remote) && $this->SoapEngine->soapEngine != $dns_engine_remote) { - // replicate change - - if (in_array($dns_engine_remote,array_keys($this->SoapEngine->soapEngines))) { - $this->SOAPloginRemote = array( - "username" => $this->SoapEngine->soapEngines[$dns_engine_remote]['username'], - "password" => $this->SoapEngine->soapEngines[$dns_engine_remote]['password'], - "admin" => true, - "impersonate" => intval($this->reseller) - ); - - $this->SOAPurlRemote=$this->SoapEngine->soapEngines[$dns_engine_remote]['url']; - - $log=sprintf ("and syncronize changes to %s",$this->SOAPurlRemote,$this->SOAPurlRemote); - dprint($log); - - $this->SoapAuthRemote = array('auth', $this->SOAPloginRemote , 'urn:AGProjects:NGNPro', 0, ''); - - $this->SoapEngineRemote = new $this->SoapEngine->soap_class($this->SOAPurlRemote); - - if (strlen($this->soapEngines[$dns_engine_remote]['timeout'])) { - $this->SoapEngineRemote->_options['timeout'] = intval($this->soapEngines[$dns_engine_remote]['timeout']); - } else { - $this->SoapEngineRemote->_options['timeout'] = $this->soapTimeout; - } - - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0); - $this->SoapEngineRemote->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0); - } - } - } - hunk ./library/ngnpro_client.php 7094 + if ($this->adminonly) $_url.= sprintf ("&reseller_filter=%s",$record->reseller); + hunk ./library/ngnpro_client.php 7114 + if ($this->adminonly) $_zone_url.= sprintf ("&reseller_filter=%s",$record->reseller); + hunk ./library/ngnpro_client.php 7123 + if ($this->adminonly) $_record_url.= sprintf ("&reseller_filter=%s",$record->reseller); + hunk ./library/ngnpro_client.php 7138 - hunk ./library/ngnpro_client.php 7269 + if ($this->adminonly) { + $this->initRemoteReplicationEngine($this->filters['reseller']); + } else { + $this->initRemoteReplicationEngine($this->reseller); + } + hunk ./library/ngnpro_client.php 7296 - $result = call_user_func_array(array(&$this->SoapEngineRemote,$this->deleteRecordFunction),array($result)); + $result = call_user_func_array(array(&$this->SoapEngineRemote,$this->deleteRecordFunction),array($id)); hunk ./library/ngnpro_client.php 7314 + if ($this->adminonly && !$this->filters['reseller']) return; + hunk ./library/ngnpro_client.php 7323 + + if ($this->adminonly) { + printf (" ",$this->filters['reseller']); + } + hunk ./library/ngnpro_client.php 7499 - list($customer,$reseller)=$this->customerFromLogin($dictionary); + if ($this->adminonly) { + if ($dictionary['reseller']) { + $this->initRemoteReplicationEngine($dictionary['reseller']); + } else if ($this->filters['reseller']) { + $this->initRemoteReplicationEngine($this->filters['reseller']); + } else { + printf ("

Error: Missing reseller. "); + return false; + } + } else { + $this->initRemoteReplicationEngine($this->reseller); + } hunk ./library/ngnpro_client.php 7890 + $this->initRemoteReplicationEngine($record->reseller); +