[Formatted file and added url generation Tijmen de Mes **20240212164122 Ignore-this: 29cf2da65fa484f74b6f9ae5c6e5fda89fcfea6928fee41028b819025d609aedea3ae9feddca2d03 ] hunk ./library/NGNPro/Records/Carriers.php 5 - var $carriers=array(); - - var $Fields=array( - 'id' => array('type'=>'integer', - 'readonly' => true), - 'name' => array('type'=>'string') - ); - - var $sortElements=array( - 'changeDate' => 'Change date', - 'name' => 'Carrier' - ); + var $carriers = array(); + + var $Fields = array( + 'id' => array( + 'type'=>'integer', + 'readonly' => true + ), + 'name' => array('type'=>'string') + ); + + var $sortElements = array( + 'changeDate' => 'Change date', + 'name' => 'Carrier' + ); hunk ./library/NGNPro/Records/Carriers.php 29 - function showCustomerTextBox () { + function showCustomerTextBox() + { hunk ./library/NGNPro/Records/Carriers.php 37 - function listRecords() { - + function listRecords() + { hunk ./library/NGNPro/Records/Carriers.php 45 - $filter=array( - 'id' => intval($this->filters['id']), - 'name' => $this->filters['name'], - 'reseller' => intval($this->filters['reseller']) - ); + $filter = array( + 'id' => intval($this->filters['id']), + 'name' => $this->filters['name'], + 'reseller' => intval($this->filters['reseller']) + ); hunk ./library/NGNPro/Records/Carriers.php 52 - $range=array('start' => intval($this->next), - 'count' => intval($this->maxrowsperpage) - ); + $range = array( + 'start' => intval($this->next), + 'count' => intval($this->maxrowsperpage) + ); hunk ./library/NGNPro/Records/Carriers.php 61 - $orderBy = array('attribute' => $this->sorting['sortBy'], - 'direction' => $this->sorting['sortOrder'] - ); + $orderBy = array( + 'attribute' => $this->sorting['sortBy'], + 'direction' => $this->sorting['sortOrder'] + ); hunk ./library/NGNPro/Records/Carriers.php 67 - $Query=array('filter' => $filter, - 'orderBy' => $orderBy, - 'range' => $range - ); + $Query = array( + 'filter' => $filter, + 'orderBy' => $orderBy, + 'range' => $range + ); hunk ./library/NGNPro/Records/Carriers.php 75 - $result = $this->SoapEngine->soapclient->getCarriers($Query); + $result = $this->SoapEngine->soapclient->getCarriers($Query); hunk ./library/NGNPro/Records/Carriers.php 80 - hunk ./library/NGNPro/Records/Carriers.php 82 - print " -
$this->rows records found
-

- - "; - - print " - - - - - - - - - - - - "; + print <<< END +
$this->rows records found
+

+

IdOwnerCarrierNameGatewaysChange dateActions
+ + + + + + + + + + + +END; hunk ./library/NGNPro/Records/Carriers.php 101 - if ($this->rows > $this->maxrowsperpage) { + if ($this->rows > $this->maxrowsperpage) { hunk ./library/NGNPro/Records/Carriers.php 105 - $maxrows=$this->rows; + $maxrows = $this->rows; hunk ./library/NGNPro/Records/Carriers.php 111 - while ($i < $maxrows) { + while ($i < $maxrows) { hunk ./library/NGNPro/Records/Carriers.php 116 - $index=$this->next+$i+1; - - $_delete_url = $this->url.sprintf("&service=%s&action=Delete&id_filter=%s", - urlencode($this->SoapEngine->service), - urlencode($carrier->id) + $base_url_data = array( + 'service' => $this->SoapEngine->service, + 'id_filter' => $carrier->id hunk ./library/NGNPro/Records/Carriers.php 121 + $delete_url_data = array_merge( + $base_url_data, + array( + 'action' => 'Delete' + ) + ); + + $_url_data = array_merge( + $base_url_data, + array( + 'reseller_filter' => $carrier->reseller + ) + ); + + $customer_url_data = array( + 'service' => sprintf('customers@%s', $this->SoapEngine->service), + 'customer_filter' => $carrier->reseller + ); + + $gateway_url_data = array( + 'service' => sprintf('pstn_gateways@%s', $this->SoapEngine->service), + 'carrier_id_filter' => $carrier->id, + 'reseller_filter' => $carrier->reseller + ); + + $index = $this->next + $i + 1; + hunk ./library/NGNPro/Records/Carriers.php 150 - $_delete_url .= "&confirm=1"; + $delete_url_data['confirm'] = 1; hunk ./library/NGNPro/Records/Carriers.php 156 - $_url = $this->url.sprintf("&service=%s&id_filter=%s&reseller_filter=%s", - urlencode($this->SoapEngine->service), - urlencode($carrier->id), - urlencode($carrier->reseller) + $_delete_url = sprintf( + "%s&%s", + $this->url, + http_build_query($delete_url_data) hunk ./library/NGNPro/Records/Carriers.php 162 - $_customer_url = $this->url.sprintf("&service=customers@%s&customer_filter=%s", - urlencode($this->SoapEngine->customer_engine), - urlencode($carrier->reseller) + $_url = sprintf( + "%s&%s", + $this->url, + http_build_query($_url_data) hunk ./library/NGNPro/Records/Carriers.php 168 - $_gateway_url = $this->url.sprintf("&service=pstn_gateways@%s&carrier_id_filter=%d&reseller_filter=%s", - urlencode($this->SoapEngine->soapEngine), - urlencode($carrier->id), - urlencode($carrier->reseller) + $_customer_url = sprintf( + "%s&%s", + $this->url, + http_build_query($customer_url_data) hunk ./library/NGNPro/Records/Carriers.php 174 - printf(" - - - - - - - - - ", - $index, - $_customer_url, - $carrier->reseller, - $_url, - $carrier->id, - $carrier->name, - $_gateway_url, - $carrier->changeDate, - $_delete_url, - $actionText + $_gateway_url = sprintf( + "%s&%s", + $this->url, + http_build_query($gateway_url_data) hunk ./library/NGNPro/Records/Carriers.php 180 - printf(" - - "); + printf( + " + + + + + + + + + + ", + $index, + $_customer_url, + $carrier->reseller, + $_url, + $carrier->id, + $carrier->name, + $_gateway_url, + $carrier->changeDate, + $_delete_url, + $actionText + ); + + print ""; hunk ./library/NGNPro/Records/Carriers.php 206 - hunk ./library/NGNPro/Records/Carriers.php 207 - hunk ./library/NGNPro/Records/Carriers.php 221 - function showAddForm() { + function showAddForm() + { hunk ./library/NGNPro/Records/Carriers.php 224 - printf ("",$_SERVER['PHP_SELF']); - print " -
- "; - - print " - - "; - print "
"; + printf("", $_SERVER['PHP_SELF']); + print <<< END +
+ +
+ +END; hunk ./library/NGNPro/Records/Carriers.php 233 - printf ("
Name
"); + print "
Name
"; hunk ./library/NGNPro/Records/Carriers.php 242 - function addRecord($dictionary=array()) { + function addRecord($dictionary = array()) + { hunk ./library/NGNPro/Records/Carriers.php 246 - $name=$dictionary['name']; + $name = $dictionary['name']; hunk ./library/NGNPro/Records/Carriers.php 251 - list($customer,$reseller)=$this->customerFromLogin($dictionary); - - $structure=array('name' => $name, + list($customer, $reseller)=$this->customerFromLogin($dictionary); + + $structure = array('name' => $name, hunk ./library/NGNPro/Records/Carriers.php 259 - printf ("

Error: Missing name. "); + printf("

Error: Missing name. "); hunk ./library/NGNPro/Records/Carriers.php 263 - $function=array('commit' => array('name' => 'addCarrier', - 'parameters' => array($structure), - 'logs' => array('success' => sprintf('Carrier %s has been added',$name))) - ); - - return $this->SoapEngine->execute($function,$this->html); + $function = array( + 'commit' => array( + 'name' => 'addCarrier', + 'parameters' => array($structure), + 'logs' => array( + 'success' => sprintf('Carrier %s has been added', $name) + ) + ) + ); + + return $this->SoapEngine->execute($function, $this->html); hunk ./library/NGNPro/Records/Carriers.php 276 - function deleteRecord($dictionary=array()) { + function deleteRecord($dictionary = array()) + { hunk ./library/NGNPro/Records/Carriers.php 284 - $id = $dictionary['id']; + $id = $dictionary['id']; hunk ./library/NGNPro/Records/Carriers.php 286 - $id = trim($this->filters['id']); + $id = trim($this->filters['id']); hunk ./library/NGNPro/Records/Carriers.php 294 - $function=array('commit' => array('name' => 'deleteCarrier', - 'parameters' => array(intval($id)), - 'logs' => array('success' => sprintf('Carrier %d has been deleted',$id))) - ); + $function = array( + 'commit' => array( + 'name' => 'deleteCarrier', + 'parameters' => array(intval($id)), + 'logs' => array( + 'success' => sprintf('Carrier %d has been deleted', $id) + ) + ) + ); hunk ./library/NGNPro/Records/Carriers.php 305 - return $this->SoapEngine->execute($function,$this->html); + return $this->SoapEngine->execute($function, $this->html); hunk ./library/NGNPro/Records/Carriers.php 308 - function showSeachFormCustom() { - printf ("

Carrier
",$this->filters['id']); - printf ("
Name
",$this->filters['name']); + function showSeachFormCustom() + { + printf( + " +
+ Carrier + +
+ ", + $this->filters['id'] + ); + printf( + " +
+ Name + +
+ ", + $this->filters['name'] + ); hunk ./library/NGNPro/Records/Carriers.php 330 - function showCustomerForm($name='customer_filter') { + function showCustomerForm($name = 'customer_filter') + { hunk ./library/NGNPro/Records/Carriers.php 334 - function showTextBeforeCustomerSelection() { + function showTextBeforeCustomerSelection() + { hunk ./library/NGNPro/Records/Carriers.php 339 - function getRecord($id) { + function getRecord($id) + { hunk ./library/NGNPro/Records/Carriers.php 345 - $filter=array('id' => intval($id)); + $filter = array('id' => intval($id)); hunk ./library/NGNPro/Records/Carriers.php 348 - $range=array('start' => 0, - 'count' => 1 - ); + $range = array( + 'start' => 0, + 'count' => 1 + ); hunk ./library/NGNPro/Records/Carriers.php 357 - $orderBy = array('attribute' => $this->sorting['sortBy'], - 'direction' => $this->sorting['sortOrder'] - ); + $orderBy = array( + 'attribute' => $this->sorting['sortBy'], + 'direction' => $this->sorting['sortOrder'] + ); hunk ./library/NGNPro/Records/Carriers.php 363 - $Query=array('filter' => $filter, - 'orderBy' => $orderBy, - 'range' => $range - ); + $Query = array( + 'filter' => $filter, + 'orderBy' => $orderBy, + 'range' => $range + ); hunk ./library/NGNPro/Records/Carriers.php 376 - if ($result->carriers[0]){ + if ($result->carriers[0]) { hunk ./library/NGNPro/Records/Carriers.php 384 - function showRecord($carrier) { - + function showRecord($carrier) + { hunk ./library/NGNPro/Records/Carriers.php 388 - - printf ("",$_SERVER['PHP_SELF']); + printf("", $_SERVER['PHP_SELF']); hunk ./library/NGNPro/Records/Carriers.php 393 - $item_name=$this->Fields[$item]['name']; + $item_name = $this->Fields[$item]['name']; hunk ./library/NGNPro/Records/Carriers.php 395 - $item_name=ucfirst($item); + $item_name = ucfirst($item); hunk ./library/NGNPro/Records/Carriers.php 398 - printf ("
-
IdOwnerCarrierNameGatewaysChange dateActions
%s%s%s%sGateways%s%s
%s%s%s%sGateways%s%s
", - $item_name + printf( + " +
+
+ ", + $item_name hunk ./library/NGNPro/Records/Carriers.php 407 - printf ("
%s
", - $item, - $carrier->$item, - $carrier->$item + printf( + "
%s
", + $item, + $carrier->$item, + $carrier->$item hunk ./library/NGNPro/Records/Carriers.php 414 - printf ("
", - $item, - $carrier->$item + printf( + "
", + $item, + $carrier->$item hunk ./library/NGNPro/Records/Carriers.php 424 - printf ("",$carier->id); + printf("", $carrier->id); hunk ./library/NGNPro/Records/Carriers.php 429 - print " -
+ print <<< END +
hunk ./library/NGNPro/Records/Carriers.php 432 -
- "; - print ""; - +
+ +END; hunk ./library/NGNPro/Records/Carriers.php 437 - function updateRecord () { + function updateRecord() + { hunk ./library/NGNPro/Records/Carriers.php 448 - $var_name=$item.'_form'; + $var_name = $item.'_form'; hunk ./library/NGNPro/Records/Carriers.php 456 - $function=array('commit' => array('name' => 'updateCarrier', - 'parameters' => array($carrier), - 'logs' => array('success' => sprintf('Carrier %d has been updated',$_REQUEST['id_filter']))) - ); - - $result = $this->SoapEngine->execute($function,$this->html); + $function = array( + 'commit' => array( + 'name' => 'updateCarrier', + 'parameters' => array($carrier), + 'logs' => array( + 'success' => sprintf('Carrier %d has been updated', $_REQUEST['id_filter']) + ) + ) + ); + + $result = $this->SoapEngine->execute($function, $this->html); hunk ./library/NGNPro/Records/Carriers.php 472 - hunk ./library/NGNPro/Records/DnsZones.php 177 - 'service' => sprintf('dns_records@%s', $this->SoapEngine->service), + 'service' => sprintf('customers@%s', $this->SoapEngine->service),