From: edward Date: Wed, 30 Mar 2016 10:23:48 +0000 (+0800) Subject: RooTrait.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=9aa8c369ee75808d1212be0bbfa98fb009070db2 RooTrait.php --- diff --git a/RooTrait.php b/RooTrait.php index 54e44aa9..741b8f65 100644 --- a/RooTrait.php +++ b/RooTrait.php @@ -69,6 +69,24 @@ trait Pman_Core_RooTrait { } + function dataObject($tab) + { + if (is_array($this->validTables) && !in_array($tab, $this->validTables)) { + $this->jerr("Invalid url - not listed in validTables"); + } + + $tab = str_replace('/', '',$tab); // basic protection?? + + $x = DB_DataObject::factory($tab); + + if (!is_a($x, 'DB_DataObject')) { + $this->jerr('invalid url - no dataobject'); + } + + return $x; + + } + /* * From Pman.php */