Esempio n. 1
0
 $domain['id'] = $id;
 if ($domain['name'] == '' && $domain['description'] == '') {
     $SESSION->redirect('?' . $SESSION->get('backto'));
 }
 if ($domain['type'] == 'SLAVE') {
     if (!check_ip($domain['master'])) {
         $error['master'] = trans('IP address of master NS is required!');
     }
 } else {
     $domain['master'] = '';
 }
 if ($domain['name'] == '') {
     $error['name'] = trans('Domain name is required!');
 } elseif (!preg_match('/^[a-z0-9._-]+$/', $domain['name'])) {
     $error['name'] = trans('Domain name contains forbidden characters!');
 } elseif ($olddomain != $domain['name'] && GetDomainIdByName($domain['name'])) {
     $error['name'] = trans('Domain with specified name exists!');
 }
 if ($domain['ownerid'] && $domain['ownerid'] != $oldowner) {
     $limits = $LMS->GetHostingLimits($domain['ownerid']);
     if ($limits['domain_limit'] !== NULL) {
         if ($limits['domain_limit'] > 0) {
             $cnt = $DB->GetOne('SELECT COUNT(*) FROM domains WHERE ownerid = ?', array($domainadd['ownerid']));
         }
         if ($limits['domain_limit'] == 0 || $limits['domain_limit'] <= $cnt) {
             $error['ownerid'] = trans('Exceeded domains limit of selected customer ($a)!', $limits['domain_limit']);
         }
     }
 }
 if (!$error) {
     $DB->Execute('UPDATE domains SET name = ?, ownerid = ?, description = ?,
Esempio n. 2
0
 } else {
     $domainadd['master'] = '';
     if (!check_ip($domainadd['ipwebserver'])) {
         $error['ipwebserwer'] = trans('IP address of webserver is required!');
     }
     if (!check_ip($domainadd['ipmailserver'])) {
         $error['ipmailserwer'] = trans('IP address of mailserver is required!');
     }
 }
 if ($domainadd['name'] == '') {
     $error['name'] = trans('Domain name is required!');
 } else {
     if ($errorname = check_hostname_fqdn($domainadd['name'], false, true)) {
         $error['name'] = $errorname;
     } else {
         if (GetDomainIdByName($domainadd['name'])) {
             $error['name'] = trans('Domain with specified name exists!');
         }
     }
 }
 if ($domainadd['ownerid']) {
     $limits = $LMS->GetHostingLimits($domainadd['ownerid']);
     if ($limits['domain_limit'] !== NULL) {
         if ($limits['domain_limit'] > 0) {
             $cnt = $DB->GetOne('SELECT COUNT(*) FROM domains WHERE ownerid = ?', array($domainadd['ownerid']));
         }
         if ($limits['domain_limit'] == 0 || $limits['domain_limit'] <= $cnt) {
             $error['ownerid'] = trans('Exceeded domains limit of selected customer ($a)!', $limits['domain_limit']);
         }
     }
 }