Commit 4e1eb639 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.0.5' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.0.5

parents 9d57538c f43ef975
ALTER TABLE `web_domain` DROP INDEX `serverdomain`, ADD UNIQUE `serverdomain` ( `server_id` , `ip_address`, `domain` );
\ No newline at end of file
......@@ -1879,7 +1879,7 @@ CREATE TABLE `web_domain` (
`added_date` date NOT NULL DEFAULT '0000-00-00',
`added_by` varchar(255) DEFAULT NULL,
PRIMARY KEY (`domain_id`),
UNIQUE KEY `serverdomain` ( `server_id` , `domain` )
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
......
......@@ -137,7 +137,8 @@ class validate_domain {
//if($check['cnt'] > 0) return false;
// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' && $domain['parent_domain_id'] > 0 ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
if(is_array($checks) && !empty($checks)){
foreach($checks as $check){
......@@ -207,7 +208,7 @@ class validate_domain {
//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
//if($check['cnt'] > 0) return false;
// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' && $domain['parent_domain_id'] > 0 ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
if(is_array($checks) && !empty($checks)){
foreach($checks as $check){
if($domain['ip_address'] == '*') return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment