force integer conversion for domainimport-offset-field, as POST sends it as string; filter IP-addresses that are unknown to froxlor when importing domains.
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -1911,7 +1911,7 @@ if ($page == 'domains'
|
||||
|
||||
$customerid = intval($_POST['customerid']);
|
||||
$separator = validate($_POST['separator'], 'separator');
|
||||
$offset = validate($_POST['offset'], 'offset', "/[0-9]/i");
|
||||
$offset = (int)validate($_POST['offset'], 'offset', "/[0-9]/i");
|
||||
|
||||
$file_name = $_FILES['file']['tmp_name'];
|
||||
|
||||
|
||||
@@ -60,6 +60,13 @@ class DomainBulkAction {
|
||||
* @var array
|
||||
*/
|
||||
private $_knownIpPort = null;
|
||||
|
||||
/**
|
||||
* array of known IP's to check against
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_knownIpPortChk = null;
|
||||
|
||||
/**
|
||||
* array of fields to import to panel_domains
|
||||
@@ -319,6 +326,13 @@ class DomainBulkAction {
|
||||
|
||||
// save iplist
|
||||
$iplist = $domain_data['ips'];
|
||||
$iplist_arr = array_unique(explode(",", $iplist));
|
||||
$knownIPsCheck = array_unique($this->_knownIpPortChk);
|
||||
// check whether we actually have at least one of the used IP's in our system
|
||||
$result_iplist = array_intersect($iplist_arr, $knownIPsCheck);
|
||||
// write back iplist
|
||||
$iplist = implode(",", $result_iplist);
|
||||
|
||||
// dont need that for the domain-insert-statement
|
||||
unset($domain_data['ips']);
|
||||
|
||||
@@ -445,6 +459,7 @@ class DomainBulkAction {
|
||||
$this->_knownIpPort = array ();
|
||||
while ($ipp = $knownip_stmt->fetch()) {
|
||||
$this->_knownIpPort[$ipp['ip']][] = $ipp;
|
||||
$this->_knownIpPortChk[] = $ipp['ip'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user