[Removed soap replication code Adrian Georgescu **20111006110137 Ignore-this: a69fde52e21d3a99f5a88998658cd521 ] hunk ./library/ngnpro_client.php 1578 - 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->SOAPloginRemoteAdmin = array( - "username" => $this->SoapEngine->soapEngines[$remote_engine]['username'], - "password" => $this->SoapEngine->soapEngines[$remote_engine]['password'], - "admin" => true - ); - - $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->SoapAuthRemoteAdmin = array('auth', $this->SOAPloginRemoteAdmin , '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 1850 - - if ($this->version > 1) { - printf (" SIP domain",$this->filters['domain']); - } + printf (" SIP domain",$this->filters['domain']); hunk ./library/ngnpro_client.php 3880 - var $remote_engine_name='enum_engine_remote'; hunk ./library/ngnpro_client.php 3938 - printf ("Engine: %s",$this->SoapEngine->soapEngine); + //printf ("Engine: %s",$this->SoapEngine->soapEngine); hunk ./library/ngnpro_client.php 4236 - if ($this->adminonly) { - $this->initRemoteReplicationEngine($this->filters['reseller']); - } else { - $this->initRemoteReplicationEngine($this->reseller); - } - hunk ./library/ngnpro_client.php 4255 - // delete remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->deleteRange($rangeId); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - unset($this->selectionActive); - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 4340 - $this->initRemoteReplicationEngine($reseller); - hunk ./library/ngnpro_client.php 4387 - - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addRange($range); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - unset($this->filters); - - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 4617 - $this->initRemoteReplicationEngine($range->reseller); - hunk ./library/ngnpro_client.php 4669 - - // update remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->updateRange($range); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 4721 - var $remote_engine_name='enum_engine_remote'; - hunk ./library/ngnpro_client.php 5409 - if ($this->adminonly) { - $this->initRemoteReplicationEngine($this->filters['reseller']); - } else { - $this->initRemoteReplicationEngine($this->reseller); - } - hunk ./library/ngnpro_client.php 5447 - // update remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->updateNumber($result); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SoapEngineRemote->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - unset($this->selectionActive); - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 5466 - - // update remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->deleteNumber($enum_id); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SoapEngineRemote->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - unset($this->selectionActive); - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 5686 - $this->initRemoteReplicationEngine($reseller); - hunk ./library/ngnpro_client.php 5822 - - // add remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addNumber($result); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SoapEngineRemote->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 5869 - - // add remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->updateNumber($result); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SoapEngineRemote->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 6095 - $this->initRemoteReplicationEngine($number->reseller); - hunk ./library/ngnpro_client.php 6185 - - // update remote if remote engine is set - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->updateNumber($result); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SoapEngineRemote->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 6191 - var $remote_engine_name='dns_engine_remote'; - hunk ./library/ngnpro_client.php 6242 - 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 6450 - if ($this->adminonly) { - $this->initRemoteReplicationEngine($this->filters['reseller']); - } else { - $this->initRemoteReplicationEngine($this->reseller); - } - hunk ./library/ngnpro_client.php 6469 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->deleteZone($name); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 6528 - $this->initRemoteReplicationEngine($reseller); - hunk ./library/ngnpro_client.php 6569 - - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addZone($zone); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - unset($this->filters); - - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 6712 - $this->initRemoteReplicationEngine($zone->reseller); - hunk ./library/ngnpro_client.php 6765 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->updateZone($zone); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - unset($this->filters); - - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 6863 - var $remote_engine_name = 'dns_engine_remote'; hunk ./library/ngnpro_client.php 7441 - if ($this->adminonly) { - $this->initRemoteReplicationEngine($this->filters['reseller']); - } else { - $this->initRemoteReplicationEngine($this->reseller); - } - hunk ./library/ngnpro_client.php 7460 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = call_user_func_array(array($this->SoapEngineRemote,$this->deleteRecordFunction),array($id)); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - unset($this->filters); - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 7674 - $this->initRemoteReplicationEngine($dictionary['reseller']); hunk ./library/ngnpro_client.php 7675 - $this->initRemoteReplicationEngine($this->filters['reseller']); hunk ./library/ngnpro_client.php 7681 - } else { - $this->initRemoteReplicationEngine($this->reseller); hunk ./library/ngnpro_client.php 7756 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = call_user_func_array(array($this->SoapEngineRemote,$this->addRecordFunction),array($result)); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - if ($this->html) { - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - } - unset($this->filters); - - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 7839 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - - $result = call_user_func_array(array($this->SoapEngineRemote,$this->addRecordFunction),array($result)); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - if ($this->html) { - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - } - unset($this->filters); - } - } + return true; hunk ./library/ngnpro_client.php 8041 - $this->initRemoteReplicationEngine($record->reseller); - hunk ./library/ngnpro_client.php 8069 - if (is_object($this->SoapEngineRemote)) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - - $result = call_user_func_array(array($this->SoapEngineRemote,$this->updateRecordFunction),array($result)); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - unset($this->filters); - - return false; - } else { - return true; - } - } else { - return true; - } + return true; hunk ./library/ngnpro_client.php 11111 - if ($_REQUEST['action'] == 'Add' || $_REQUEST['action'] == 'Copy' || - $_REQUEST['action'] == 'Delete' || $_REQUEST['action'] == 'Update') { - - if ($this->reseller) { - $customer_engine_remote=$this->SoapEngine->login_credentials['reseller_filters'][$this->reseller]['customer_engine_remote']; - - if (strlen($customer_engine_remote) && $this->SoapEngine->soapEngine != $customer_engine_remote) { - // replicate change - - if (in_array($customer_engine_remote,array_keys($this->SoapEngine->soapEngines))) { - $this->SOAPloginRemote = array( - "username" => $this->SoapEngine->soapEngines[$customer_engine_remote]['username'], - "password" => $this->SoapEngine->soapEngines[$customer_engine_remote]['password'], - "admin" => true, - "impersonate" => intval($this->reseller) - ); - - $this->SOAPloginRemoteAdmin = array( - "username" => $this->SoapEngine->soapEngines[$customer_engine_remote]['username'], - "password" => $this->SoapEngine->soapEngines[$customer_engine_remote]['password'], - "admin" => true - ); - - //dprint_r($this->SOAPloginRemote); - $this->SOAPurlRemote=$this->SoapEngine->soapEngines[$customer_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->SoapAuthRemoteAdmin = array('auth', $this->SOAPloginRemoteAdmin , 'urn:AGProjects:NGNPro', 0, ''); - - $this->SoapEngineRemote = new $this->SoapEngine->soap_class($this->SOAPurlRemote); - - if (strlen($this->soapEngines[$customer_engine_remote]['timeout'])) { - $this->SoapEngineRemote->_options['timeout'] = intval($this->soapEngines[$customer_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 11420 - if (is_object($this->SoapEngineRemote)) { - - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->deleteAccount(intval($this->filters['customer'])); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - if ($error_fault->detail->exception->errorcode != 5000) { - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - } - } - } - hunk ./library/ngnpro_client.php 12071 - - // update remote - if (is_object($this->SoapEngineRemote)) { - - if ($this->adminonly) { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemoteAdmin); - } else { - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - } - $result = $this->SoapEngineRemote->updateAccount($customer); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - - if ($error_fault->detail->exception->errorcode == 5000) { - // try add the missing customer - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addAccount($customer); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - - // roll back local changes - - $function=array('commit' => array('name' => 'updateAccount', - 'parameters' => array($customer_old), - 'logs' => array('success' => sprintf('Customer id %s has been rolled back',$customer->id)) - ) - ); - - $this->SoapEngine->execute($function,$this->html); - return false; - - } else { - return true; - } - - } else { - // roll back local changes - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - - $function=array('commit' => array('name' => 'updateAccount', - 'parameters' => array($customer_old), - 'logs' => array('success' => sprintf('Customer id %s has been rolled back',$customer->id)) - ) - ); - - $this->SoapEngine->execute($function,$this->html); - return false; - } - - } else { - return true; - } - } - hunk ./library/ngnpro_client.php 12193 - // update remote - if (is_object($this->SoapEngineRemote)) { - if ($_id = $this->getCustomerId($customer_new->username)) { - - $customerRemote=$customer_new; - $customerRemote->id = intval($_id); - - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addAccount($customerRemote); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - - $function=array('commit' => array('name' => 'deleteAccount', - 'parameters' => array(intval($_id)), - 'logs' => array('success' => sprintf('Customer id %s could not be copied ',$this->filters['customer']))) - ); - - $this->SoapEngine->execute($function,$this->html); - return false; - } - } - } - hunk ./library/ngnpro_client.php 12470 - // update remote - - if (is_object($this->SoapEngineRemote)) { - if ($_id = $this->getCustomerId($customer['username'])) { - $customerRemote=$customer; - $customerRemote['id'] = intval($_id); - - $this->SoapEngineRemote->addHeader($this->SoapAuthRemote); - $result = $this->SoapEngineRemote->addAccount($customerRemote); - - if (PEAR::isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - - $function=array('commit' => array('name' => 'deleteAccount', - 'parameters' => array(intval($_id)), - 'logs' => array('success' => sprintf('Customer id %s could not be created ',$this->filters['customer']))) - ); - - $this->SoapEngine->execute($function,$this->html); - return false; - } - } - } hunk ./library/ngnpro_client.php 14654 + //printf ("Performing action=%s on key=%s",$action,$key['name']);