From 9aa8c369ee75808d1212be0bbfa98fb009070db2 Mon Sep 17 00:00:00 2001 From: edward Date: Wed, 30 Mar 2016 18:23:48 +0800 Subject: [PATCH] RooTrait.php --- RooTrait.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 */ -- 2.39.2