public function __construct($strTable)
{
parent::__construct();
/** @var SessionInterface $objSession */
$objSession = \System::getContainer()->get('session');
// Check the request token (see #4007)
if (isset($_GET['act'])) {
if (!isset($_GET['rt']) || !\RequestToken::validate(\Input::get('rt'))) {
$objSession->set('INVALID_TOKEN_URL', \Environment::get('request'));
$this->redirect('contao/confirm.php');
}
}
$this->intId = \Input::get('id', true);
// Clear the clipboard
if (isset($_GET['clipboard'])) {
$objSession->set('CLIPBOARD', array());
$this->redirect($this->getReferer());
}
// Check whether the table is defined
if ($strTable == '' || !isset($GLOBALS['TL_DCA'][$strTable])) {
$this->log('Could not load data container configuration for "' . $strTable . '"', __METHOD__, TL_ERROR);
trigger_error('Could not load data container configuration', E_USER_ERROR);
}
// Check permission to create new folders
if (\Input::get('act') == 'paste' && \Input::get('mode') == 'create' && isset($GLOBALS['TL_DCA'][$strTable]['list']['new'])) {
throw new AccessDeniedException('Attempt to create a new folder although the method has been overwritten in the data container.');
}
// Set IDs and redirect
if (\Input::post('FORM_SUBMIT') == 'tl_select') {
$ids = \Input::post('IDS');
if (empty($ids) || !is_array($ids)) {
$this->reload();
}
// Decode the values (see #5764)
$ids = array_map('rawurldecode', $ids);
$session = $objSession->all();
$session['CURRENT']['IDS'] = $ids;
$objSession->replace($session);
if (isset($_POST['edit'])) {
$this->redirect(str_replace('act=select', 'act=editAll', \Environment::get('request')));
} elseif (isset($_POST['delete'])) {
$this->redirect(str_replace('act=select', 'act=deleteAll', \Environment::get('request')));
} elseif (isset($_POST['cut']) || isset($_POST['copy'])) {
$arrClipboard = $objSession->get('CLIPBOARD');
$arrClipboard[$strTable] = array('id' => $ids, 'mode' => isset($_POST['cut']) ? 'cutAll' : 'copyAll');
$objSession->set('CLIPBOARD', $arrClipboard);
$this->redirect($this->getReferer());
}
}
$this->strTable = $strTable;
$this->blnIsDbAssisted = $GLOBALS['TL_DCA'][$strTable]['config']['databaseAssisted'];
// Check for valid file types
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['validFileTypes']) {
$this->arrValidFileTypes = \StringUtil::trimsplit(',', strtolower($GLOBALS['TL_DCA'][$this->strTable]['config']['validFileTypes']));
}
// Call onload_callback (e.g. to check permissions)
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onload_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onload_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
$callback($this);
}
}
}
// Get all filemounts (root folders)
if (is_array($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root'])) {
$this->arrFilemounts = $this->eliminateNestedPaths($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root']);
}
}