Falko Timme
2013-10-18 2d2fd172e1548dd24e1719accd0b856cff6a31a0
interface/web/sites/shell_user_edit.php
@@ -99,7 +99,17 @@
      global $app, $conf;
      
      // 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 = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
        //if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
      if(isset($this->dataRecord["parent_domain_id"])) {
         $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'));
         if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
      } else {
         $tmp = $app->tform->getDataRecord($this->id);
         $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval($tmp["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
         if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
         unset($tmp);
      }
      
      // Set a few fixed values
      $this->dataRecord["server_id"] = $parent_domain["server_id"];
@@ -121,7 +131,7 @@
      $blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
      foreach($blacklist as $line) {
         if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
            $app->tform->errorMessage .= 'The username is not allowed.';
            $app->tform->errorMessage .= $app->tform->lng('username_not_allowed_txt');
         }
      }
      unset($blacklist);
@@ -138,6 +148,8 @@
            $this->dataRecord['username_prefix'] = $shelluser_prefix;
         /* restrict the names */
         $this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
         if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
      }
      parent::onBeforeInsert();
   }
@@ -166,7 +178,7 @@
      $blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
      foreach($blacklist as $line) {
         if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
            $app->tform->errorMessage .= 'The username is not allowed.';
            $app->tform->errorMessage .= $app->tform->lng('username_not_allowed_txt');
         }
      }
      unset($blacklist);
@@ -188,6 +200,8 @@
            
         /* restrict the names */
         $this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
         if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
      }
   }