diff --git a/library/NGNPro/Records/TrustedPeers.php b/library/NGNPro/Records/TrustedPeers.php index cb24c61..aec63d7 100644 --- a/library/NGNPro/Records/TrustedPeers.php +++ b/library/NGNPro/Records/TrustedPeers.php @@ -1,676 +1,759 @@ array('type'=>'boolean', 'name' => 'MS Teams'), 'prepaid' => array('type'=>'boolean'), + 'enumLookup' => array('type'=>'boolean', 'name' => 'ENUM lookup'), + 'transit' => array('type'=>'boolean', 'name' => 'Transit'), 'blocked' => array('type'=>'integer'), 'tenant' => array('type'=>'string'), 'carrierName' => array('type'=>'string', 'name' => 'LCR carrier'), 'originator' => array('type'=>'string', 'name' => 'LCR originator'), - 'enumLookup' => array('type'=>'integer'), - 'transit' => array('type'=>'integer'), 'description' => array('type'=>'string'), 'callLimit' => array('type'=>'integer', 'name' => 'Capacity') ); var $Fields = array( 'prefix' => array('type'=>'string', 'name' => 'Add prefix'), 'strip' => array('type'=>'integer', 'name' => 'Strip digits'), 'authToken' => array('type'=>'string', 'name' => 'Authentication token') ); public function __construct($SoapEngine) { $this->filters = array( 'ip' => trim($_REQUEST['ip_filter']), 'tenant' => trim($_REQUEST['tenant_filter']), 'description' => trim($_REQUEST['description_filter']), 'msteams' => trim($_REQUEST['msteams_filter']), - 'blocked' => trim($_REQUEST['blocked_filter']) ); + if (strlen($_REQUEST['blocked_filter'])) { + $this->filters['blocked'] = intval(trim($_REQUEST['blocked_filter'])); + } + parent::__construct($SoapEngine); $this->sortElements = array( 'changeDate' => 'Change date', 'description' => 'Description', 'ip' => 'Address' ); } function listRecords() { $this->showSeachForm(); // Insert credetials $this->SoapEngine->soapclient->addHeader($this->SoapEngine->SoapAuth); // Filter $filter = array( 'ip' => $this->filters['ip'], 'description' => $this->filters['description'], 'tenant' => $this->filters['tenant'], - 'msteams' => 1 == intval($this->filters['msteams']), - 'blocked' => 1 == intval($this->filters['blocked']) + 'msteams' => 1 == intval($this->filters['msteams']) ); + if (strlen($this->filters['blocked'])) { + $filter['blocked'] = intval($this->filters['blocked']); + } + // Range $range = array( 'start' => intval($this->next), 'count' => intval($this->maxrowsperpage) ); // Order if (!$this->sorting['sortBy']) $this->sorting['sortBy'] = 'description'; if (!$this->sorting['sortOrder']) $this->sorting['sortOrder'] = 'ASC'; $orderBy = array( 'attribute' => $this->sorting['sortBy'], 'direction' => $this->sorting['sortOrder'] ); // Compose query $Query = array( 'filter' => $filter, 'orderBy' => $orderBy, 'range' => $range ); // Call function $this->log_action('getTrustedPeers'); $result = $this->SoapEngine->soapclient->getTrustedPeers($Query); if ($this->checkLogSoapError($result, true)) { return false; } else { $this->rows = $result->total; if ($this->rows && $_REQUEST['action'] != 'PerformActions' && $_REQUEST['action'] != 'Delete') { $this->showActionsForm(); } +if (intval($this->filters['msteams'])) { print <<< END
Id | Owner | Trusted peer | Blocked | Prepaid | ENUM | Transit | Capacity | -MS Teams | Tenant | Carrier | Originator | Description | Strip | Prefix | Change date | Actions |
Id + | Owner | +Trusted peer | +Blocked | +Prepaid | +ENUM | +Transit | +Capacity | +Carrier | +Originator | +Description | +Strip | +Prefix | +Change date | +Actions | +||
%s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | -%s | %s |
%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +%s | +
|
Error: Missing IP or description. "; return false; } $peer = array( 'ip' => $ipaddress, 'description' => $description, 'callLimit' => intval($callLimit), 'msteams' => 1 == $msteams, 'tenant' => $tenant, 'carrierName' => $carrierName, 'originator' => $originator, 'prefix' => $prefix, 'strip' => intval($strip), 'blocked' => 0, 'enumLookup' => 1, 'transit' => 0, 'owner' => intval($_REQUEST['owner']), 'customer' => intval($customer), 'reseller' => intval($reseller) ); $function = array( 'commit' => array( 'name' => 'addTrustedPeer', 'parameters' => array($peer), 'logs' => array( 'success' => sprintf('Trusted peer %s has been added', $ipaddress) ) ) ); return $this->SoapEngine->execute($function, $this->html); } 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'], 'authToken' => $_REQUEST['authToken_form'], 'tenant' => $_REQUEST['tenant_form'], 'carrierName' => $_REQUEST['carrierName_form'], 'originator' => $_REQUEST['originator_form'], 'prefix' => $_REQUEST['prefix_form'], 'strip' => intval($_REQUEST['strip_form']), 'callLimit' => intval($_REQUEST['callLimit_form']), 'prepaid' => 1 == $_REQUEST['prepaid_form'], - 'blocked' => 1 == $_REQUEST['blocked_form'], + 'blocked' => intval($_REQUEST['blocked_form']), 'enumLookup' => 1 == $_REQUEST['enumLookup_form'], 'transit' => 1 == $_REQUEST['transit_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); } function deleteRecord($dictionary = array()) { if (!$dictionary['confirm'] && !$_REQUEST['confirm']) { print "
Please press on Confirm to confirm the delete. "; return true; } if (!strlen($this->filters['ip'])) { print "
Error: missing IP address. "; return false; } $function = array( 'commit' => array( 'name' => 'deleteTrustedPeer', 'parameters' => array($this->filters['ip']), 'logs' => array( 'success' => sprintf('Trusted peer %s has been deleted', $this->filters['ip']) ) ) ); unset($this->filters); return $this->SoapEngine->execute($function, $this->html); } function showSeachFormCustom() { if (intval($this->filters['msteams']) == 1) { $checked_msteams = 'checked'; } else { $checked_msteams = ''; } printf( "