Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 2b76ffa

Browse files
committed
Check the table existence in the page and file picker (see #7346)
1 parent 9c272cc commit 2b76ffa

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

system/modules/core/controllers/BackendFile.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,15 @@ public function run()
8181
$objDca->field = $strField;
8282

8383
// Set the active record
84-
$strModel = \Model::getClassFromTable($strTable);
85-
$objModel = $strModel::findByPk(\Input::get('id'));
86-
87-
if ($objModel !== null)
84+
if ($this->Database->tableExists($strTable))
8885
{
89-
$objDca->activeRecord = $objModel;
86+
$strModel = \Model::getClassFromTable($strTable);
87+
$objModel = $strModel::findByPk(\Input::get('id'));
88+
89+
if ($objModel !== null)
90+
{
91+
$objDca->activeRecord = $objModel;
92+
}
9093
}
9194

9295
// AJAX request

system/modules/core/controllers/BackendPage.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,15 @@ public function run()
8181
$objDca->field = $strField;
8282

8383
// Set the active record
84-
$strModel = \Model::getClassFromTable($strTable);
85-
$objModel = $strModel::findByPk(\Input::get('id'));
86-
87-
if ($objModel !== null)
84+
if ($this->Database->tableExists($strTable))
8885
{
89-
$objDca->activeRecord = $objModel;
86+
$strModel = \Model::getClassFromTable($strTable);
87+
$objModel = $strModel::findByPk(\Input::get('id'));
88+
89+
if ($objModel !== null)
90+
{
91+
$objDca->activeRecord = $objModel;
92+
}
9093
}
9194

9295
// AJAX request

0 commit comments

Comments
 (0)