Marius Burkard
2016-07-10 e1ceb050e19c7574bca146a8da7047ee4ff456b5
interface/web/sites/web_childdomain_edit.php
@@ -136,7 +136,7 @@
      } else {
         if($this->_childdomain_type == 'subdomain') {
            // Get the record of the parent domain
            $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
            $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ?", @$this->dataRecord["parent_domain_id"]);
            // remove the parent domain part of the domain name before we show it in the text field.
            $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
@@ -165,9 +165,16 @@
   function onSubmit() {
      global $app, $conf;
      // Get the record of the parent domain
      if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
         $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ?", $this->id);
         if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
         unset($tmp);
      }
      // Get the record of the parent domain
      $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
      $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), @$this->dataRecord["parent_domain_id"]);
      if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
      /* check if the domain module is used - and check if the selected domain can be used! */
      $app->uses('ini_parser,getconf');
@@ -207,7 +214,7 @@
      //* make sure that the domain is lowercase
      if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
      parent::onSubmit();
   }
@@ -229,7 +236,7 @@
         //* Update the old website, so that the vhost alias gets removed
         //* We force the update by inserting a transaction record without changes manually.
         $old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$app->functions->intval($this->oldDataRecord['domain_id']));
         $old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $this->oldDataRecord['domain_id']);
         $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $app->functions->intval($this->oldDataRecord['parent_domain_id']), $old_website, $old_website, true);
      }