diff --git a/library/NGNPro/Records/EnumRanges.php b/library/NGNPro/Records/EnumRanges.php index c453b1a..a77c710 100644 --- a/library/NGNPro/Records/EnumRanges.php +++ b/library/NGNPro/Records/EnumRanges.php @@ -1,843 +1,843 @@ array( 'type'=>'integer', 'help' => 'Range owner' ) ); var $Fields = array( 'customer' => array('type'=>'integer', 'help' => 'Range owner' ), 'serial' => array('type'=>'integer', 'help'=>'DNS serial number', 'readonly' => 1 ), 'ttl' => array('type'=>'integer', 'help'=>'Cache period in DNS clients' ), 'info' => array('type'=>'string', 'help' =>'Range description' ), 'size' => array('type'=>'integer', 'help'=>'Maximum number of telephone numbers' ), 'minDigits' => array('type'=>'integer', 'help'=>'Minimum number of digits for telephone numbers' ), 'maxDigits' => array('type'=>'integer', 'help'=>'Maximum number of digits for telephone numbers' ) ); public function __construct($SoapEngine) { dprint("init EnumRanges"); $this->filters = array( 'prefix' => trim(ltrim($_REQUEST['prefix_filter']), '+'), 'tld' => trim($_REQUEST['tld_filter']), 'info' => trim($_REQUEST['info_filter']) ); parent::__construct($SoapEngine); $this->sortElements = array( 'changeDate' => 'Change date', 'prefix' => 'Prefix', 'tld' => 'TLD' ); /* $this->Fields['nameservers'] = array('type'=>'text', 'name'=>'Name servers', 'help'=>'Name servers authoritative for this DNS zone' ); */ if ($this->login_credentials['reseller_filters'][$this->reseller]['record_generator']) { //printf("Engine: %s",$this->SoapEngine->soapEngine); if (is_array($this->login_credentials['reseller_filters'][$this->reseller]['record_generator'])) { $_rg = $this->login_credentials['reseller_filters'][$this->reseller]['record_generator']; if ($_rg[$this->SoapEngine->soapEngine]) { $this->record_generator = $_rg[$this->SoapEngine->soapEngine]; } } else { $this->record_generator = $this->login_credentials['reseller_filters'][$this->reseller]['record_generator']; } } elseif (strlen($this->SoapEngine->record_generator)) { $this->record_generator = $this->SoapEngine->record_generator; } } function listRecords() { $this->getAllowedDomains(); $this->showSeachForm(); // Filter $filter = array( 'prefix' => $this->filters['prefix'], 'tld' => $this->filters['tld'], 'info' => $this->filters['info'], 'customer' => intval($this->filters['customer']), 'reseller' => intval($this->filters['reseller']) ); // Range $range = array( 'start' => intval($this->next), 'count' => intval($this->maxrowsperpage) ); // Order if (!$this->sorting['sortBy']) $this->sorting['sortBy'] = 'changeDate'; if (!$this->sorting['sortOrder']) $this->sorting['sortOrder'] = 'DESC'; $orderBy = array( 'attribute' => $this->sorting['sortBy'], 'direction' => $this->sorting['sortOrder'] ); // Compose query $Query = array( 'filter' => $filter, 'orderBy' => $orderBy, 'range' => $range ); $this->SoapEngine->soapclient->addHeader($this->SoapEngine->SoapAuth); $this->log_action('getRanges'); $result = $this->SoapEngine->soapclient->getRanges($Query); if ($this->checkLogSoapError($result, true)) { return false; } else { $this->rows = $result->total; if ($this->rows && $_REQUEST['action'] != 'PerformActions' && $_REQUEST['action'] != 'Delete') { $this->showActionsForm(); } print <<< END
Id | Owner | Prefix | TLD | Serial | TTL | Info | Min | Max | Size | Used | Change date | Actions | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
%s | %s.%s | +%s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s%s |
Please press on Confirm to confirm the delete. "; return true; } if (!strlen($this->filters['prefix']) || !strlen($this->filters['tld'])) { print "
Error: missing ENUM range id "; return false; } $rangeId = array('prefix'=>$this->filters['prefix'], 'tld'=>$this->filters['tld']); $function = array( 'commit' => array( 'name' => 'deleteRange', 'parameters' => array($rangeId), 'logs' => array( 'success' => sprintf( 'ENUM range +%s under %s has been deleted', $this->filters['prefix'], $this->filters['tld'] ) ) ) ); unset($this->filters); $result = $this->SoapEngine->execute($function, $this->html); if ($this->checkLogSoapError($result, true)) { return false; } else { return true; } } function showAddForm() { if ($this->selectionActive) return; printf("
"; } function addRecord($dictionary = array()) { $tld = trim($_REQUEST['tld']); $prefix = trim($_REQUEST['prefix']); $size = trim($_REQUEST['size']); $info = trim($_REQUEST['info']); if (!strlen($tld)) { $tld = $this->SoapEngine->default_enum_tld; } if (!strlen($tld) || !strlen($prefix) || !is_numeric($prefix)) { printf("Error: Missing TLD or prefix. "); return false; } if (!$this->adminonly) { if (in_array($prefix, $this->deniedPrefixes)) { print "
Error: Only an administrator account can create the prefix coresponding to a country code."; return false; } } list($customer, $reseller)=$this->customerFromLogin($dictionary); if (!trim($_REQUEST['ttl'])) { $ttl = 3600; } else { $ttl = intval(trim($_REQUEST['ttl'])); } $range = array( 'id' => array( 'prefix' => $prefix, 'tld' => $tld ), 'ttl' => $ttl, 'info' => $info, 'minDigits' => intval(trim($_REQUEST['minDigits'])), 'maxDigits' => intval(trim($_REQUEST['maxDigits'])), 'size' => intval($size), 'customer' => intval($customer), 'reseller' => intval($reseller) ); $deleteRange = array( 'prefix'=>$prefix, 'tld'=>$tld ); $_p = array( array( 'name' => 'enum_ranges_last_tld', 'category' => 'web', 'value' => "$tld", 'permission' => 'customer' ) ); $this->setCustomerProperties($_p); $function = array( 'commit' => array( 'name' => 'addRange', 'parameters' => array($range), 'logs' => array('success' => sprintf('ENUM range +%s under %s has been added', $prefix, $tld)) ) ); $result = $this->SoapEngine->execute($function, $this->html); dprint_r($result); if ($this->checkLogSoapError($result, true)) { return false; } else { return true; } } function showSeachFormCustom() { printf( "
Updating range ...";
if (!$_REQUEST['prefix_filter'] || !$_REQUEST['tld_filter']) return;
$rangeid = array(
'prefix' => $_REQUEST['prefix_filter'],
'tld' => $_REQUEST['tld_filter']
);
if (!$range = $this->getRecord($rangeid)) {
return false;
}
$range_old = $range;
foreach (array_keys($this->Fields) as $item) {
$var_name = $item.'_form';
//printf(" |