mcramer
2012-09-11 4e18bd4210f5c79d341436b1ed026300d59ba208
interface/web/sites/web_domain_edit.php
@@ -418,7 +418,7 @@
         /*
          * The admin can select ALL domains, the user only the domains assigned to him
          */
         $sql = "SELECT domain FROM domain ";
         $sql = "SELECT domain_id, domain FROM domain ";
         if ($_SESSION["s"]["user"]["typ"] != 'admin') {
            $sql .= "WHERE sys_groupid =" . $client_group_id;
         }
@@ -428,7 +428,7 @@
         if(is_array($domains) && sizeof($domains) > 0) {
            /* We have domains in the list, so create the drop-down-list */
            foreach( $domains as $domain) {
               $domain_select .= "<option value=" . $domain['domain'] ;
               $domain_select .= "<option value=" . $domain['domain_id'] ;
               if ($domain['domain'] == $this->dataRecord["domain"]) {
                  $domain_select .= " selected";
               }
@@ -458,6 +458,25 @@
   function onSubmit() {
      global $app, $conf;
        /* 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') {
         $client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
            $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['domain']);
         if ($_SESSION["s"]["user"]["typ"] != 'admin') {
            $sql .= "AND sys_groupid =" . $client_group_id;
         }
         $domain_check = $app->db->queryOneRecord($sql);
            if(!$domain_check) {
                // invalid domain selected
                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
            } else {
                $this->dataRecord['domain'] = $domain_check['domain'];
            }
        }
      // Set a few fixed values
      $this->dataRecord["parent_domain_id"] = 0;
      $this->dataRecord["type"] = 'vhost';