[Added Trusted Peer edit functions Adrian Georgescu **20210804154101 Ignore-this: 9585ed8f8eb3239b9cd94ffc338e8953 ] hunk ./library/ngnpro_client.php 5 - Copyright (c) 2007-2020 AG Projects + Copyright (c) 2007-2021 AG Projects hunk ./library/ngnpro_client.php 700 - "Failed to add record: %s (%s): %s", + "SOAP query failed: %s (%s): %s", hunk ./library/ngnpro_client.php 8917 + var $Fields=array( + 'msteams' => array('type'=>'boolean'), + 'callLimit' => array('type'=>'integer'), + 'description' => array('type'=>'string') + ); hunk ./library/ngnpro_client.php 9030 - $_url = $this->url.sprintf("&service=%s&action=Delete&ip_filter=%s&msteams_filter=%s", + $delete_url = $this->url.sprintf("&service=%s&action=Delete&ip_filter=%s&msteams_filter=%s", hunk ./library/ngnpro_client.php 9036 + $update_url = $this->url.sprintf("&service=%s&action=Update&ip_filter=%s", + urlencode($this->SoapEngine->service), + urlencode($peer->ip) + ); + hunk ./library/ngnpro_client.php 9043 - $_url .= "&confirm=1"; + $delete_url .= "&confirm=1"; hunk ./library/ngnpro_client.php 9058 - %s + %s hunk ./library/ngnpro_client.php 9069 + $update_url, hunk ./library/ngnpro_client.php 9076 - $_url, + $delete_url, hunk ./library/ngnpro_client.php 9085 - + + if ($result->total == 1) { + $this->showRecord($peer); + } hunk ./library/ngnpro_client.php 9095 + function showRecord($peer) { + + print ""; + print " + +
+ "; + printf ("",$_SERVER['PHP_SELF']); + print ""; + + print " + "; + + if ($this->adminonly) { + + foreach (array_keys($this->FieldsAdminOnly) as $item) { + if ($this->FieldsAdminOnly[$item]['name']) { + $item_name=$this->FieldsAdminOnly[$item]['name']; + } else { + $item_name=ucfirst($item); + } + + if ($this->FieldsAdminOnly[$item]['type'] == 'text') { + printf (" + + + ", + $item_name, + $item, + $peer->$item + ); + } else { + printf (" + + + ", + $item_name, + $item, + $peer->$item + ); + } + } + } + + foreach (array_keys($this->Fields) as $item) { + if ($this->Fields[$item]['name']) { + $item_name=$this->Fields[$item]['name']; + } else { + $item_name=ucfirst($item); + } + + if ($this->Fields[$item]['type'] == 'text') { + printf (" + + + ", + $item_name, + $item, + $peer->$item + ); + } else if ($this->Fields[$item]['type'] == 'boolean') { + if ($peer->$item == 1) { + $checked = "checked"; + } else { + $checked = ""; + } + + printf (" + + + ", + $item_name, + $item, + $checked + ); + } else { + printf (" + + + ", + $item_name, + $item, + $peer->$item + ); + } + } + + printf ("",$peer->ip); + $this->printFiltersToForm(); + + $this->printHiddenFormElements(); + + print ""; + print " +
+
%s
%s
%s
%s
%s
+ "; + } + hunk ./library/ngnpro_client.php 9208 - printf ("
Call limit
"); + printf ("
Call limit
"); hunk ./library/ngnpro_client.php 9278 + function updateRecord() { + list($customer,$reseller)=$this->customerFromLogin($dictionary); + + if (!strlen($this->filters['ip'])) { + print "

Error: missing peer address. "; + return false; + } + $peer=array( + 'ip' => $this->filters['ip'], + 'description' => $_REQUEST['description_form'], + 'callLimit' => intval($_REQUEST['callLimit_form']), + 'msteams' => 1 == $_REQUEST['msteams_form'], + 'customer' => intval($customer), + 'reseller' => intval($reseller) + ); + + $function=array('commit' => array('name' => 'updateTrustedPeer', + 'parameters' => array($peer), + 'logs' => array('success' => sprintf('Trusted peer %s has been updated',$this->filters['ip']))) + ); + + return $this->SoapEngine->execute($function,$this->html); + } + hunk ./library/ngnpro_soap_library.php 490 + function &updateTrustedPeer($peer) + { + $peer = new SOAP_Value('peer', '{urn:AGProjects:NGNPro}TrustedPeer', $peer); + $result = $this->call('updateTrustedPeer', + $v = array('peer' => $peer), + array('namespace' => 'urn:AGProjects:NGNPro:Sip', + 'soapaction' => '', + 'style' => 'rpc', + 'use' => 'encoded')); + return $result; + }