Marius Burkard
2016-06-14 1ec27d7366ac58df1d2d8cfc426be2c33d9cfa2c
interface/web/sites/web_vhost_domain_edit.php
@@ -1341,8 +1341,13 @@
      
      // Letsencrypt can not be activated before the website has been created
      // So we deactivate it here and add a datalog update in onAfterInsert
      if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y') {
      if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y' && isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y') {
         // Disable letsencrypt and ssl temporarily
         $this->dataRecord['ssl_letsencrypt'] = 'n';
         $this->dataRecord['ssl'] = 'n';
         // Prevent that the datalog history gets written
         $app->tform->formDef['db_history'] = 'no';
         // Set variable that we check in onAfterInsert
         $this->_letsencrypt_on_insert = true;
      }
   }
@@ -1418,12 +1423,13 @@
      }
      if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id);
      
      // Add a datalog update with letsencrypt enabled (see also onBeforeInsert)
      // Add a datalog insert without letsencrypt and then an update with letsencrypt enabled (see also onBeforeInsert)
      if($this->_letsencrypt_on_insert == true) {
         $tmp = $web_rec;
         $tmp['ssl_letsencrypt'] = 'y';
         $app->db->datalogUpdate('web_domain', $tmp, 'domain_id', $this->id);
         unset($tmp);
         $new_data_record = $app->tform->getDataRecord($this->id);
         $app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record);
         $new_data_record['ssl_letsencrypt'] = 'y';
         $new_data_record['ssl'] = 'y';
         $app->db->datalogUpdate('web_domain', $new_data_record, 'domain_id', $this->id);
      }
   
   }
@@ -1454,9 +1460,13 @@
               $this->dataRecord["domain"] = $rec['domain'];
            }
            if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
               //* Add a error message and switch back to old server
               $app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv4-Address.');
               $this->dataRecord["ip_address"] = $rec['ip_address'];
            }
            if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
               //* Add a error message and switch back to old server
               $app->tform->errorMessage .= $app->lng('The IP can not be changed. Please ask your Administrator if you want to change the IPv6-Address.');
               $this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
            }
            unset($rec);