"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core-bundle/src/Resources/contao/dca/tl_content.php" between
contao-4.8.1.tar.gz and contao-4.8.2.tar.gz

About: Contao (fka TYPOlight) is a content management system (CMS). Latest release.

tl_content.php  (contao-4.8.1):tl_content.php  (contao-4.8.2)
skipping to change at line 25 skipping to change at line 25
'config' => array 'config' => array
( (
'dataContainer' => 'Table', 'dataContainer' => 'Table',
'enableVersioning' => true, 'enableVersioning' => true,
'ptable' => '', 'ptable' => '',
'dynamicPtable' => true, 'dynamicPtable' => true,
'markAsCopy' => 'headline', 'markAsCopy' => 'headline',
'onload_callback' => array 'onload_callback' => array
( (
array('tl_content', 'adjustDcaByType'), array('tl_content', 'adjustDcaByType'),
array('tl_content', 'showJsLibraryHint') array('tl_content', 'showJsLibraryHint'),
array('tl_content', 'preserveReferenced')
), ),
'sql' => array 'sql' => array
( (
'keys' => array 'keys' => array
( (
'id' => 'primary', 'id' => 'primary',
'pid,ptable,invisible,sorting' => 'index' 'pid,ptable,invisible,sorting' => 'index'
) )
) )
), ),
skipping to change at line 842 skipping to change at line 843
'eval' => array('rgxp'=>'datim', 'date picker'=>true, 'tl_class'=>'w50 wizard'), 'eval' => array('rgxp'=>'datim', 'date picker'=>true, 'tl_class'=>'w50 wizard'),
'sql' => "varchar(10) NOT NULL defaul t ''" 'sql' => "varchar(10) NOT NULL defaul t ''"
) )
) )
); );
// Dynamically add the permission check and parent table (see #5241) // Dynamically add the permission check and parent table (see #5241)
if (Contao\Input::get('do') == 'article' || Contao\Input::get('do') == 'page') if (Contao\Input::get('do') == 'article' || Contao\Input::get('do') == 'page')
{ {
$GLOBALS['TL_DCA']['tl_content']['config']['ptable'] = 'tl_article'; $GLOBALS['TL_DCA']['tl_content']['config']['ptable'] = 'tl_article';
$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array(' tl_content', 'checkPermission'); array_unshift($GLOBALS['TL_DCA']['tl_content']['config']['onload_callback '], array('tl_content', 'checkPermission'));
} }
/** /**
* Provide miscellaneous methods that are used by the data configuration array. * Provide miscellaneous methods that are used by the data configuration array.
* *
* @author Leo Feyer <https://github.com/leofeyer> * @author Leo Feyer <https://github.com/leofeyer>
*/ */
class tl_content extends Contao\Backend class tl_content extends Contao\Backend
{ {
skipping to change at line 867 skipping to change at line 868
{ {
parent::__construct(); parent::__construct();
$this->import('Contao\BackendUser', 'User'); $this->import('Contao\BackendUser', 'User');
} }
/** /**
* Check permissions to edit table tl_content * Check permissions to edit table tl_content
*/ */
public function checkPermission() public function checkPermission()
{ {
/** @var Symfony\Component\HttpFoundation\Session\SessionInterfac
e $objSession */
$objSession = Contao\System::getContainer()->get('session');
// Prevent deleting referenced elements (see #4898)
if (Contao\Input::get('act') == 'deleteAll')
{
$objCes = $this->Database->prepare("SELECT cteAlias FROM
tl_content WHERE (ptable='tl_article' OR ptable='') AND type='alias'")
->execut
e();
$session = $objSession->all();
$session['CURRENT']['IDS'] = array_diff($session['CURRENT
']['IDS'], $objCes->fetchEach('cteAlias'));
$objSession->replace($session);
}
if ($this->User->isAdmin) if ($this->User->isAdmin)
{ {
return; return;
} }
// Get the pagemounts // Get the pagemounts
$pagemounts = array(); $pagemounts = array();
foreach ($this->User->pagemounts as $root) foreach ($this->User->pagemounts as $root)
{ {
skipping to change at line 927 skipping to change at line 914
case 'copyAll': case 'copyAll':
// Check access to the parent element if a conten t element is moved // Check access to the parent element if a conten t element is moved
if (Contao\Input::get('act') == 'cutAll' || Conta o\Input::get('act') == 'copyAll') if (Contao\Input::get('act') == 'cutAll' || Conta o\Input::get('act') == 'copyAll')
{ {
$this->checkAccessToElement(Contao\Input: :get('pid'), $pagemounts, (Contao\Input::get('mode') == 2)); $this->checkAccessToElement(Contao\Input: :get('pid'), $pagemounts, (Contao\Input::get('mode') == 2));
} }
$objCes = $this->Database->prepare("SELECT id FRO M tl_content WHERE (ptable='tl_article' OR ptable='') AND pid=?") $objCes = $this->Database->prepare("SELECT id FRO M tl_content WHERE (ptable='tl_article' OR ptable='') AND pid=?")
->execute(CURRENT_ID); ->execute(CURRENT_ID);
/** @var Symfony\Component\HttpFoundation\Session
\SessionInterface $objSession */
$objSession = Contao\System::getContainer()->get(
'session');
$session = $objSession->all(); $session = $objSession->all();
$session['CURRENT']['IDS'] = array_intersect((arr ay) $session['CURRENT']['IDS'], $objCes->fetchEach('id')); $session['CURRENT']['IDS'] = array_intersect((arr ay) $session['CURRENT']['IDS'], $objCes->fetchEach('id'));
$objSession->replace($session); $objSession->replace($session);
break; break;
case 'cut': case 'cut':
case 'copy': case 'copy':
// Check access to the parent element if a conten t element is moved // Check access to the parent element if a conten t element is moved
$this->checkAccessToElement(Contao\Input::get('pi d'), $pagemounts, (Contao\Input::get('mode') == 2)); $this->checkAccessToElement(Contao\Input::get('pi d'), $pagemounts, (Contao\Input::get('mode') == 2));
// no break // no break
skipping to change at line 1058 skipping to change at line 1048
unset($GLOBALS['TL_DCA']['tl_content']['fields'][ 'imageUrl']); unset($GLOBALS['TL_DCA']['tl_content']['fields'][ 'imageUrl']);
break; break;
case 'image': case 'image':
$GLOBALS['TL_DCA']['tl_content']['fields']['image margin']['eval']['tl_class'] .= ' clr'; $GLOBALS['TL_DCA']['tl_content']['fields']['image margin']['eval']['tl_class'] .= ' clr';
break; break;
} }
} }
/** /**
* Prevent deleting referenced elements (see #4898)
*/
public function preserveReferenced()
{
if (Contao\Input::get('act') == 'delete')
{
$objCes = $this->Database->prepare("SELECT COUNT(*) AS cn
t FROM tl_content WHERE (ptable='tl_article' OR ptable='') AND type='alias' AND
cteAlias=?")
->execut
e(Contao\Input::get('id'));
if ($objCes->cnt > 0)
{
throw new Contao\CoreBundle\Exception\InternalSer
verErrorException('Content element ID ' . Contao\Input::get('id') . ' is used in
an alias element and can therefore not be deleted.');
}
}
if (Contao\Input::get('act') == 'deleteAll')
{
$objCes = $this->Database->prepare("SELECT cteAlias FROM
tl_content WHERE (ptable='tl_article' OR ptable='') AND type='alias'")
->execut
e();
/** @var Symfony\Component\HttpFoundation\Session\Session
Interface $objSession */
$objSession = Contao\System::getContainer()->get('session
');
$session = $objSession->all();
$session['CURRENT']['IDS'] = array_diff($session['CURRENT
']['IDS'], $objCes->fetchEach('cteAlias'));
$objSession->replace($session);
}
}
/**
* Show a hint if a JavaScript library needs to be included in the page l ayout * Show a hint if a JavaScript library needs to be included in the page l ayout
* *
* @param object * @param object
*/ */
public function showJsLibraryHint($dc) public function showJsLibraryHint($dc)
{ {
if ($_POST || Contao\Input::get('act') != 'edit') if ($_POST || Contao\Input::get('act') != 'edit')
{ {
return; return;
} }
 End of changes. 5 change blocks. 
20 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)