From c44fe476a8aa96f75a3e003a9ca4c9898a2d1c15 Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Fri, 3 Oct 2014 14:58:26 +0200 Subject: [PATCH] Check the table existence in the page and file picker (see #7346) --- system/modules/core/controllers/BackendFile.php | 13 ++++++++----- system/modules/core/controllers/BackendPage.php | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/system/modules/core/controllers/BackendFile.php b/system/modules/core/controllers/BackendFile.php index 36cb07d159..3ffb9733aa 100644 --- a/system/modules/core/controllers/BackendFile.php +++ b/system/modules/core/controllers/BackendFile.php @@ -81,12 +81,15 @@ public function run() $objDca->field = $strField; // Set the active record - $strModel = \Model::getClassFromTable($strTable); - $objModel = $strModel::findByPk(\Input::get('id')); - - if ($objModel !== null) + if (\Database::getInstance()->tableExists($strTable)) { - $objDca->activeRecord = $objModel; + $strModel = \Model::getClassFromTable($strTable); + $objModel = $strModel::findByPk(\Input::get('id')); + + if ($objModel !== null) + { + $objDca->activeRecord = $objModel; + } } // AJAX request diff --git a/system/modules/core/controllers/BackendPage.php b/system/modules/core/controllers/BackendPage.php index 6cb4c1ca6a..64aa2a700f 100644 --- a/system/modules/core/controllers/BackendPage.php +++ b/system/modules/core/controllers/BackendPage.php @@ -81,12 +81,15 @@ public function run() $objDca->field = $strField; // Set the active record - $strModel = \Model::getClassFromTable($strTable); - $objModel = $strModel::findByPk(\Input::get('id')); - - if ($objModel !== null) + if (\Database::getInstance()->tableExists($strTable)) { - $objDca->activeRecord = $objModel; + $strModel = \Model::getClassFromTable($strTable); + $objModel = $strModel::findByPk(\Input::get('id')); + + if ($objModel !== null) + { + $objDca->activeRecord = $objModel; + } } // AJAX request