Dominik Mueller
2014-01-23 ab7528750fd9fc5ada5f6ce1decd3a64b9fcd4c3
interface/web/sites/web_domain_edit.php
@@ -611,6 +611,13 @@
         if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
         if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
         // only generate quota and traffic warnings if value has changed
         if($this->id > 0) {
            $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
         }  else {
            $old_web_values = array();
         }
         //* Check the website quota of the client
         if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
            $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
@@ -855,8 +862,10 @@
      $php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
      $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
      $htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);
      $added_date = date($app->lng('conf_format_dateshort'));
      $added_by = $app->db->quote($_SESSION['s']['user']['username']);
      $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
      $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir', added_date = '$added_date', added_by = '$added_by'  WHERE domain_id = ".$this->id;
      $app->db->query($sql);
   }
@@ -983,7 +992,7 @@
         $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id);
         foreach($records as $rec) {
            $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
            if($rec['type'] == 'vhostsubdomain') {
            if($rec['type'] == 'vhostsubdomain' || $rec['type'] == 'vhostalias') {
               $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$rec['web_folder'], $web_config["php_open_basedir"]);
               $php_open_basedir = str_replace("[website_domain]/web", $rec['domain'].'/'.$rec['web_folder'], $php_open_basedir);
               $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
@@ -1008,7 +1017,7 @@
      //* If the domain name has been changed, we will have to change all subdomains + APS instances
      if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
         $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
         $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
         foreach($records as $rec) {
            $subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"], $this->dataRecord["domain"], $rec['domain']));
            $app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']);
@@ -1068,9 +1077,9 @@
         unset($backup_interval);
      }
      //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
      //* Change vhost subdomain and alias ip/ipv6 if domain ip/ipv6 has changed
      if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
         $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
         $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ".$this->id);
         foreach($records as $rec) {
            $app->db->datalogUpdate('web_domain', "ip_address = '".$app->db->quote($web_rec['ip_address'])."', ipv6_address = '".$app->db->quote($web_rec['ipv6_address'])."'", 'domain_id', $rec['domain_id']);
         }