Index: t3lib/stddb/tbl_be.php =================================================================== --- t3lib/stddb/tbl_be.php (revision 8742) +++ t3lib/stddb/tbl_be.php (revision ) @@ -820,4 +820,77 @@ ) ); + +/** + * System News (displayed on Login screen) + */ +$TCA['sys_news'] = array( + 'ctrl' => $TCA['sys_news']['ctrl'], + 'interface' => array( + 'showRecordFieldList' => 'hidden,title,content,starttime,endtime' + ), + 'columns' => array( + 'hidden' => array( + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.disable', + 'exclude' => 1, + 'config' => array( + 'type' => 'check', + 'default' => '0' + ) + ), + 'starttime' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', + 'config' => array( + 'type' => 'input', + 'size' => '8', + 'max' => '20', + 'eval' => 'date', + 'checkbox' => '0', + 'default' => '0' + ) + ), + 'endtime' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', + 'config' => array( + 'type' => 'input', + 'size' => '8', + 'max' => '20', + 'eval' => 'date', + 'checkbox' => '0', + 'default' => '0' + ) + ), + 'title' => array( + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.title', + 'config' => array( + 'type' => 'input', + 'size' => '30', + 'max' => '255', + 'eval' => 'required' + ) + ), + 'content' => array( + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.text', + 'config' => array( + 'type' => 'text', + 'cols' => '48', + 'rows' => '5' + ) + ) + ), + 'types' => array( + '1' => array('showitem' => ' + hidden, title, content, + --div--;LLL:EXT:cms/locallang_tca.xml:sys_news.tabs.access, starttime, endtime' + ) + ) +); + + + + + + ?> \ No newline at end of file Index: typo3/sysext/lang/locallang_tca.xml =================================================================== --- typo3/sysext/lang/locallang_tca.xml (revision 6833) +++ typo3/sysext/lang/locallang_tca.xml (revision ) @@ -99,6 +99,8 @@ + + Index: typo3/index.php =================================================================== --- typo3/index.php (revision 8742) +++ typo3/index.php (revision ) @@ -560,6 +560,19 @@ function makeLoginNews() { $newsContent = ''; + $systemNews = $this->getSystemNews(); + if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) { + /** @deprecated since 4.5. Use system news records instead. */ + t3lib_div::logDeprecatedFunction(); + + $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] = array_merge( + $systemNews, + $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] + ); + } else { + $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] = $systemNews; + } + // Traverse news array IF there are records in it: if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && !t3lib_div::_GP('loginRefresh')) { @@ -579,7 +592,7 @@ $newsItemMarker = array( '###HEADER###' => htmlspecialchars($newsItem['header']), '###DATE###' => htmlspecialchars($newsItem['date']), - '###CONTENT###' => trim($newsItem['content']), + '###CONTENT###' => t3lib_div::removeXSS(trim($newsItem['content'])), '###CLASS###' => $additionalClass ); @@ -597,6 +610,40 @@ } /** + * Gets news from sys_news and converts them into a format suitable for + * showing them at the login screen. + * + * @return array An array of login news. + */ + protected function getSystemNews() { + $systemNewsTable = 'sys_news'; + $systemNews = array(); + + $systemNewsRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + 'title, content, crdate', + $systemNewsTable, + '1=1' . + t3lib_BEfunc::BEenableFields($systemNewsTable) . + t3lib_BEfunc::deleteClause($systemNewsTable), + '', + 'crdate DESC' + ); + + foreach ($systemNewsRecords as $systemNewsRecord) { + $systemNews[] = array( + 'date' => date( + $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], + $systemNewsRecord['crdate'] + ), + 'header' => $systemNewsRecord['title'], + 'content' => $systemNewsRecord['content'] + ); + } + + return $systemNews; + } + + /** * Returns the form tag * * @return string Opening form tag string Index: t3lib/stddb/tables.sql =================================================================== --- t3lib/stddb/tables.sql (revision 8873) +++ t3lib/stddb/tables.sql (revision ) @@ -426,3 +426,23 @@ PRIMARY KEY (uid), KEY parent (pid) ); + +# +# Table structure for table 'sys_news' +# +CREATE TABLE sys_news ( + uid int(11) unsigned NOT NULL auto_increment, + pid int(11) unsigned DEFAULT '0' NOT NULL, + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(3) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + title varchar(255) DEFAULT '' NOT NULL, + content mediumtext, + + PRIMARY KEY (uid), + KEY parent (pid) +); Index: t3lib/stddb/tables.php =================================================================== --- t3lib/stddb/tables.php (revision 8832) +++ t3lib/stddb/tables.php (revision ) @@ -425,6 +425,34 @@ +/** + * Table "sys_news": + * Holds news records to be displayed in the login screen + * This is only the 'header' part (ctrl). The full configuration is found in t3lib/stddb/tbl_be.php + */ +$TCA['sys_news'] = array( + 'ctrl' => array( + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'title' => 'LLL:EXT:lang/locallang_tca.xml:sys_news', + 'cruser_id' => 'cruser_id', + 'adminOnly' => TRUE, + 'rootLevel' => TRUE, + 'delete' => 'deleted', + 'enablecolumns' => array( + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime' + ), + 'default_sortby' => 'crdate DESC', + 'typeicon_classes' => array( + 'default' => 'mimetypes-x-sys_news', + ), + 'dynamicConfigFile' => 'T3LIB:tbl_be.php', + 'versioningWS_alwaysAllowLiveEdit' => TRUE + ) +);