diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index e0cd6631c..f1bf03407 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -137,9 +137,11 @@ class DB_Model extends FHC_Model return $this->_error(lang('fhc_'.FHC_NOPK), FHC_MODEL_ERROR); - // Check rights - if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); + // Check rights only if this method is called from a model + //var_dump(get_called_class()); + if (substr(get_called_class(), -6) == '_model') + if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); // DB-SELECT // Check for composite Primary Key @@ -173,8 +175,11 @@ class DB_Model extends FHC_Model return $this->_error(lang('fhc_'.FHC_NODBTABLE), FHC_MODEL_ERROR); // Check rights - if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); + // Check rights only if this method is called from a model + //var_dump(get_called_class()); + if (substr(get_called_class(), -6) == '_model') + if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); // DB-SELECT if (is_null($where)) @@ -199,8 +204,11 @@ class DB_Model extends FHC_Model return $this->_error(lang('fhc_'.FHC_NODBTABLE), FHC_MODEL_ERROR); // Check rights for joined table - if (! $this->fhc_db_acl->isBerechtigt($this->acl[$joinTable], 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$joinTable], FHC_MODEL_ERROR); + // Check rights only if this method is called from a model + //var_dump(get_called_class()); + if (substr(get_called_class(), -6) == '_model') + if (! $this->fhc_db_acl->isBerechtigt($this->acl[$joinTable], 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$joinTable], FHC_MODEL_ERROR); $this->db->join($joinTable, $cond, $type); @@ -270,9 +278,11 @@ class DB_Model extends FHC_Model if (is_null($this->pk)) return $this->_error(lang('fhc_'.FHC_NOPK), FHC_MODEL_ERROR); - // Check rights - if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 'd')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); + // Check rights only if this method is called from a model + //var_dump(get_called_class()); + if (substr(get_called_class(), -6) == '_model') + if (! $this->fhc_db_acl->isBerechtigt($this->acl[$this->dbTable], 'd')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl[$this->dbTable], FHC_MODEL_ERROR); // DB-DELETE // Check for composite Primary Key diff --git a/include/benutzer.class.php b/include/benutzer.class.php index 7bbc740a6..105639175 100644 --- a/include/benutzer.class.php +++ b/include/benutzer.class.php @@ -51,6 +51,12 @@ class benutzer extends person */ public function load($uid = null) { + if (empty($uid)) + { + $this->errormsg = "UID not set!"; + return false; + } + $qry = "SELECT * FROM public.tbl_benutzer WHERE uid=".$this->db_add_param($uid); if($this->db_query($qry)) diff --git a/include/berechtigung.class.php b/include/berechtigung.class.php index 50a1c05e3..ac140eead 100644 --- a/include/berechtigung.class.php +++ b/include/berechtigung.class.php @@ -52,6 +52,12 @@ class berechtigung extends Berechtigung_model */ public function load($berechtigung_kurzbz = null) { + if (empty($berechtigung_kurzbz)) + { + $this->errormsg = "berechtigung not set!"; + return false; + } + $result = parent::load($berechtigung_kurzbz); if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval)) diff --git a/include/funktion.class.php b/include/funktion.class.php index faf3daeee..6e72a9631 100644 --- a/include/funktion.class.php +++ b/include/funktion.class.php @@ -111,7 +111,8 @@ class funktion extends Funktion_model */ public function load($funktion_kurzbz = null) { - if ($funktion_kurzbz == '') + + if (empty($funktion_kurzbz) || $funktion_kurzbz == '') { $this->errormsg = 'funktion_bz darf nicht leer sein'; return false; @@ -218,4 +219,4 @@ class funktion extends Funktion_model } } } -?> \ No newline at end of file +?> diff --git a/include/studiensemester.class.php b/include/studiensemester.class.php index 1ed0b8a1c..13e199655 100644 --- a/include/studiensemester.class.php +++ b/include/studiensemester.class.php @@ -61,6 +61,12 @@ class studiensemester extends Studiensemester_model */ public function load($studiensemester_kurzbz = null) { + if (empty($studiensemester_kurzbz)) + { + $this->errormsg = "studiensemester not set!"; + return false; + } + $result = parent::load($studiensemester_kurzbz); if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))