florian030
2014-02-25 cce9d63279d9078dd0292dd015be497600ac5f32
interface/web/sites/web_vhost_domain_edit.php
@@ -719,6 +719,14 @@
      /* check if the domain module is used - and check if the selected domain can be used! */
      if($app->tform->getCurrentTab() == 'domain') {
         if($this->_vhostdomain_type == 'subdomain') {
            // Check that domain (the subdomain part) is not empty
            if(!preg_match('/^[a-zA-Z0-9].*/',$this->dataRecord['domain'])) {
               $app->tform->errorMessage .= $app->tform->lng("subdomain_error_empty")."<br />";
            }
         }
         /* check if the domain module is used - and check if the selected domain can be used! */
         $app->uses('ini_parser,getconf');
         $settings = $app->getconf->get_global_config('domains');
         if ($settings['use_domain_module'] == 'y') {
@@ -769,15 +777,15 @@
         $client['web_servers_ids'] = explode(',', $client['web_servers']);
         if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
         if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
         if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
         if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
         if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
         if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = 'n';
         if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = 'n';
         if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = 'n';
         if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = 'n';
         if($client['limit_python'] != 'y') $this->dataRecord['python'] = 'n';
         if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
         if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
         if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
         if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
         if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = 'n';
         if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = 'n';
         if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = 'n';
         // only generate quota and traffic warnings if value has changed
         if($this->id > 0) {
@@ -867,15 +875,15 @@
            $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
            // set the settings to current if not provided (or cleared due to limits)
            if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
            if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
            if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
            if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
            if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
            if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
            if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
            if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
            if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
            if($this->dataRecord['cgi'] == 'n') $this->dataRecord['cgi'] = $tmp['cgi'];
            if($this->dataRecord['ssi'] == 'n') $this->dataRecord['ssi'] = $tmp['ssi'];
            if($this->dataRecord['perl'] == 'n') $this->dataRecord['perl'] = $tmp['perl'];
            if($this->dataRecord['ruby'] == 'n') $this->dataRecord['ruby'] = $tmp['ruby'];
            if($this->dataRecord['python'] == 'n') $this->dataRecord['python'] = $tmp['python'];
            if($this->dataRecord['suexec'] == 'n') $this->dataRecord['suexec'] = $tmp['suexec'];
            if($this->dataRecord['errordocs'] == 'n') $this->dataRecord['errordocs'] = $tmp['errordocs'];
            if($this->dataRecord['subdomain'] == 'n') $this->dataRecord['subdomain'] = $tmp['subdomain'];
            if($this->dataRecord['ssl'] == 'n') $this->dataRecord['ssl'] = $tmp['ssl'];
            unset($tmp);
            // When the record is inserted
@@ -993,6 +1001,35 @@
         if(!$rewrites_are_valid || $if_level != 0){
            $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
         }
      }
      // check custom php.ini settings
      if(isset($this->dataRecord['custom_php_ini']) && trim($this->dataRecord['custom_php_ini']) != '') {
         $custom_php_ini_settings = trim($this->dataRecord['custom_php_ini']);
         $custom_php_ini_settings_are_valid = true;
         // Make sure we only have Unix linebreaks
         $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
         $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings);
         $custom_php_ini_settings_lines = explode("\n", $custom_php_ini_settings);
         if(is_array($custom_php_ini_settings_lines) && !empty($custom_php_ini_settings_lines)){
            foreach($custom_php_ini_settings_lines as $custom_php_ini_settings_line){
               if(trim($custom_php_ini_settings_line) == '') continue;
               if(substr(trim($custom_php_ini_settings_line),0,1) == ';') continue;
               // empty value
               if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
               // value inside ""
               if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*".*"\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
               // value inside ''
               if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*\'.*\'\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
               // everything else
               if(preg_match('@^\s*;*\s*[a-zA-Z0-9._]*\s*=\s*[-a-zA-Z0-9~&=_\@/,.#\s]*\s*;*\s*$@', $custom_php_ini_settings_line)) continue;
               $custom_php_ini_settings_are_valid = false;
               break;
            }
         }
         if(!$custom_php_ini_settings_are_valid){
            $app->tform->errorMessage .= $app->tform->lng("invalid_custom_php_ini_settings_txt").'<br>';
         }
      }
@@ -1120,7 +1157,6 @@
      }
   }
}
$page = new page_action;