mcramer
2012-09-11 4e18bd4210f5c79d341436b1ed026300d59ba208
interface/web/mail/mail_domain_edit.php
@@ -126,7 +126,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;
         }
@@ -136,7 +136,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";
               }
@@ -184,7 +184,27 @@
   function onSubmit() {
      global $app, $conf;
      if($_SESSION["s"]["user"]["typ"] != 'admin') {
        /* 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'];
            }
        }
        if($_SESSION["s"]["user"]["typ"] != 'admin') {
         // Get the limits of the client
         $client_group_id = $_SESSION["s"]["user"]["default_group"];