Commit 4cf1f42f authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

Hooks in tslib_fe, Frontend login mode feature for pages; various other things. see changelog


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@574 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 163532bc
2005-03-08 Kasper Skårhøj,,, <kasper@typo3.com>
* New feature for page records: Frontend Login Mode. Makes it possible to disable (and enable later) frontend logins for branches of the page tree. Disabling will make it look like no user is authenticated. This feature is very useful if you wish a highly performant website using cache control headers while specifying sections where user logins are accepted (for dynamic content)
* Implemented a bunch of hooks in tslib_fe
* Minor bug fixes and re-arrangements
* Support for "crawler" extension in indexed_search; Makes it possible to index pages in the page tree by starting a crawler from the backend of TYPO3 (The extension "crawler" is specifically supported) and thus preventing the process from happening during frontend users browsing.
2005-03-07 Karsten Dambekalns <karsten@typo3.org>
* Fixed the potential security issue with mailforms, allowing
......
......@@ -153,6 +153,7 @@ Element Browser:
- Selecting files from other resource-fields of records (which the user can actually read) - maybe with the Element Browser, browsing for record, clicking it, seeing a list of files inside the record?)
- Ability to insert images when their info page (larger thumbnail) is displayed. Maybe a small + (plus) icon would do. (Notify Patrick Roeder)
- Some quick-lookup feature (like we have on TER)
- Showing more than the title column for records listing and making it possible to sort by the columns.
Wizards:
- Add wizard icon to TSconfig and Setup/Constants fields for immediate syntax highlighting (in popup window)
......
......@@ -1365,8 +1365,6 @@ class t3lib_BEfunc {
*
*******************************************/
/**
* Returns the difference in days between input $tstamp and $EXEC_TIME
* Usage: 2 (class t3lib_BEfunc)
......@@ -1387,7 +1385,7 @@ class t3lib_BEfunc {
* @return string Formatted time
*/
function date($tstamp) {
return Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
}
/**
......@@ -1398,7 +1396,7 @@ class t3lib_BEfunc {
* @return string Formatted time
*/
function datetime($value) {
return Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$value);
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $value);
}
/**
......
......@@ -3016,6 +3016,31 @@ class t3lib_div {
return $authCode;
}
/**
* Splits the input query-parameters into an array with certain parameters filtered out.
* Used to create the cHash value
*
* @param string Query-parameters: "&xxx=yyy&zzz=uuu"
* @return array Array with key/value pairs of query-parameters WITHOUT a certain list of variable names (like id, type, no_cache etc) and WITH a variable, encryptionKey, specific for this server/installation
* @see tslib_fe::makeCacheHash(), tslib_cObj::typoLink()
*/
function cHashParams($addQueryParams) {
$params = explode('&',substr($addQueryParams,1)); // Splitting parameters up
// Make array:
$pA = array();
foreach($params as $theP) {
$pKV = explode('=', $theP); // Splitting single param by '=' sign
if (!t3lib_div::inList('id,type,no_cache,cHash,MP,ftu',$pKV[0])) {
$pA[$pKV[0]] = (string)rawurldecode($pKV[1]);
}
}
$pA['encryptionKey'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
ksort($pA);
return $pA;
}
/**
* Loads the $TCA (Table Configuration Array) for the $table
*
......
......@@ -454,7 +454,7 @@ class t3lib_pageSelect {
if ($row['prepend_params']) {
$rURL = ereg_replace('\/$','',$rURL);
$prependStr = ereg_replace('^\/','',substr($request_uri,strlen($path)));
$rURL.='/'.$prependStr;
$rURL.= '/'.$prependStr;
}
Header('Location: '.t3lib_div::locationHeaderUrl($rURL));
exit;
......@@ -479,7 +479,7 @@ class t3lib_pageSelect {
function getRootLine($uid, $MP='', $ignoreMPerrors=FALSE) {
// Initialize:
$selFields = t3lib_div::uniqueList('pid,uid,t3ver_oid,title,alias,nav_title,media,layout,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,TSconfig,storage_pid,is_siteroot,mount_pid,mount_pid_ol,'.$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']);
$selFields = t3lib_div::uniqueList('pid,uid,t3ver_oid,title,alias,nav_title,media,layout,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,TSconfig,storage_pid,is_siteroot,mount_pid,mount_pid_ol,fe_login_mode,'.$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']);
$this->error_getRootLine = '';
$this->error_getRootLine_failPid = 0;
......
......@@ -434,6 +434,18 @@ if (TYPO3_MODE=='BE') {
'default' => ''
)
),
'fe_login_mode' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:cms/locallang_tca.php:pages.fe_login_mode',
'config' => Array (
'type' => 'select',
'items' => Array (
Array('', 0),
Array('LLL:EXT:cms/locallang_tca.php:pages.fe_login_mode.disable', 1),
Array('LLL:EXT:cms/locallang_tca.php:pages.fe_login_mode.enable', 2),
)
)
),
'l18n_cfg' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:cms/locallang_tca.php:pages.l18n_cfg',
......@@ -456,11 +468,11 @@ if (TYPO3_MODE=='BE') {
// Totally overriding all type-settings:
$TCA['pages']['types'] = Array (
'1' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg'),
'2' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, abstract;;5;;3-3-3, keywords, description, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, module, content_from_pid'),
'2' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, abstract;;5;;3-3-3, keywords, description, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, fe_login_mode, module, content_from_pid'),
'3' => Array('showitem' => 'hidden;;;;1-1-1, doktype, title;;3;;2-2-2, nav_hide, url;;;;3-3-3, urltype, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg'),
'4' => Array('showitem' => 'hidden;;;;1-1-1, doktype, title;;3;;2-2-2, nav_hide, shortcut;;;;3-3-3, shortcut_mode, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg'),
'5' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, module, content_from_pid'),
'7' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, mount_pid;;;;3-3-3, mount_pid_ol, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, module, content_from_pid'),
'5' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, fe_login_mode, module, content_from_pid'),
'7' => Array('showitem' => 'hidden;;;;1-1-1, doktype;;2;button, title;;3;;2-2-2, subtitle, nav_hide, nav_title, --div--, mount_pid;;;;3-3-3, mount_pid_ol, media;;;;4-4-4, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, l18n_cfg, fe_login_mode, module, content_from_pid'),
'199' => Array('showitem' => 'hidden;;;;1-1-1, doktype, title;;;;2-2-2, TSconfig;;6;nowrap;5-5-5, storage_pid;;7'),
'254' => Array('showitem' => 'hidden;;;;1-1-1, doktype, title;LLL:EXT:lang/locallang_general.php:LGL.title;;;2-2-2, --div--, TSconfig;;6;nowrap;5-5-5, storage_pid;;7, module'),
'255' => Array('showitem' => 'hidden;;;;1-1-1, doktype, title;;;;2-2-2')
......
......@@ -387,5 +387,6 @@ CREATE TABLE pages (
mount_pid_ol tinyint(4) DEFAULT '0' NOT NULL,
alias varchar(20) DEFAULT '' NOT NULL,
l18n_cfg tinyint(4) DEFAULT '0' NOT NULL,
fe_login_mode tinyint(4) DEFAULT '0' NOT NULL,
KEY alias (alias)
);
\ No newline at end of file
......@@ -266,10 +266,10 @@ class tx_cms_layout extends recordList {
$this->fieldArray = explode(',','title,uid,'.implode(',',array_keys($tableNames)));
break;
case 2:
$this->fieldArray = explode(',','title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot');
$this->fieldArray = explode(',','title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot,fe_login_mode');
break;
default:
$this->fieldArray = explode(',','title,uid,alias,starttime,endtime,fe_group,target,url,shortcut');
$this->fieldArray = explode(',','title,uid,alias,starttime,endtime,fe_group,target,url,shortcut,shortcut_mode');
break;
}
......
......@@ -80,6 +80,9 @@
<label index="pages_language_overlay">Alternative Page Language</label>
<label index="sys_template">Template</label>
<label index="static_template">Static templates</label>
<label index="pages.fe_login_mode">Login Mode:</label>
<label index="pages.fe_login_mode.disable">Disable</label>
<label index="pages.fe_login_mode.enable">Enable</label>
</languageKey>
<languageKey index="dk">EXT:csh_dk/cms/dk.locallang_tca.xml</languageKey>
<languageKey index="de">EXT:csh_de/cms/de.locallang_tca.xml</languageKey>
......
......@@ -4987,7 +4987,7 @@ class tslib_cObj {
if (substr($addQueryParams,0,1)!='&') {
$addQueryParams = '';
} elseif ($conf['useCacheHash']) { // cache hashing:
$pA = $GLOBALS['TSFE']->cHashParams($addQueryParams.$GLOBALS['TSFE']->linkVars); // Added '.$this->linkVars' dec 2003: The need for adding the linkVars is that they will be included in the link, but not the cHash. Thus the linkVars will always be the problem that prevents the cHash from working. I cannot see what negative implications in terms of incompatibilities this could bring, but for now I hope there are none. So here we go... (- kasper)
$pA = t3lib_div::cHashParams($addQueryParams.$GLOBALS['TSFE']->linkVars); // Added '.$this->linkVars' dec 2003: The need for adding the linkVars is that they will be included in the link, but not the cHash. Thus the linkVars will always be the problem that prevents the cHash from working. I cannot see what negative implications in terms of incompatibilities this could bring, but for now I hope there are none. So here we go... (- kasper)
$addQueryParams.= '&cHash='.t3lib_div::shortMD5(serialize($pA));
}
// Add "&MP" var:
......
This diff is collapsed.
......@@ -142,6 +142,11 @@ class tslib_feUserAuth extends t3lib_userAuth {
$this->TSdataArray = array();
$this->userTS = array();
$this->userTSUpdated = 0;
$this->groupData = Array(
'title' => Array(),
'uid' => Array(),
'pid' => Array()
);
// Setting default configuration:
$this->TSdataArray[]=$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultUserTSconfig'];
......
......@@ -75,7 +75,7 @@ $TT->push('','Script start');
// *********************
// DIV Library included
// Mandatory libraries included
// *********************
$TT->push('Include class t3lib_db, t3lib_div, t3lib_extmgm','');
require(PATH_t3lib.'class.t3lib_div.php');
......@@ -95,7 +95,7 @@ if (!t3lib_extMgm::isLoaded('cms')) die('<strong>Error:</strong> The main fronte
require(PATH_t3lib.'class.t3lib_db.php');
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$CLIENT=t3lib_div::clientInfo(); // Set to the browser: net / msie if 4+ browsers
$CLIENT = t3lib_div::clientInfo(); // Set to the browser: net / msie if 4+ browsers
$TT->pull();
......@@ -131,7 +131,7 @@ if (!get_magic_quotes_gpc()) {
// Create $TSFE object (TSFE = TypoScript Front End)
// Connecting to database
// ***********************************
$temp_TSFEclassName=t3lib_div::makeInstanceClassName('tslib_fe');
$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
$TSFE = new $temp_TSFEclassName(
$TYPO3_CONF_VARS,
t3lib_div::_GP('id'),
......@@ -484,6 +484,12 @@ if (is_object($BE_USER)) {
}
// ******************
// Hook for end-of-frontend
// ******************
$TSFE->hook_eofe();
// ********************
// Finish timetracking
// ********************
......
......@@ -147,7 +147,6 @@ class tx_cms_webinfo_page extends t3lib_extobjbase {
);
} else {
$h_func.= t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[pages]',$this->pObj->MOD_SETTINGS['pages'],$this->pObj->MOD_MENU['pages'],'index.php');
$dblist->start($this->pObj->id,'pages',0);
$dblist->generateList();
......
......@@ -158,6 +158,9 @@ class tx_indexedsearch_indexer {
var $tstamp_minAge = 0; // If set, this tells a minimum limit before a document can be indexed again. This is regardless of mtime.
var $maxExternalFiles = 0; // Max number of external files to index.
var $forceIndexing = FALSE; // If true, indexing is forced despite of hashes etc.
var $crawlerActive = FALSE; // Set when crawler is detected (internal)
// INTERNALS:
var $defaultContentArray=array(
'title' => '',
......@@ -200,11 +203,25 @@ class tx_indexedsearch_indexer {
// Indexer configuration from Extension Manager interface:
$indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
// Crawler activation:
// Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction:
if (t3lib_extMgm::isLoaded('crawler')
&& $pObj->applicationData['tx_crawler']['running']
&& in_array('tx_indexedsearch_reindex', $pObj->applicationData['tx_crawler']['parameters']['procInstructions'])) {
// Setting simple log message:
$pObj->applicationData['tx_crawler']['log'][] = 'Forced Re-indexing enabled';
// Setting variables:
$this->crawlerActive = TRUE; // Crawler active flag
$this->forceIndexing = TRUE; // Force indexing despite timestamps etc.
}
// Determine if page should be indexed, and if so, configure and initialize indexer
if ($pObj->config['config']['index_enable']) {
$this->log_push('Index page','');
if (!$indexerConfig['disableFrontendIndexing']) {
if (!$indexerConfig['disableFrontendIndexing'] || $this->crawlerActive) {
if (!$pObj->page['no_search']) {
if (!$pObj->no_cache) {
......@@ -482,10 +499,12 @@ class tx_indexedsearch_indexer {
$check = $this->checkMtimeTstamp($this->conf['mtime'], $this->hash['phash']);
$is_grlist = $this->is_grlist_set($this->hash['phash']);
if ($check > 0 || !$is_grlist) {
if ($check > 0 || !$is_grlist || $this->forceIndexing) {
// Setting message:
if ($check > 0) {
if ($this->forceIndexing) {
$this->log_setTSlogMessage('Indexing needed, reason: Forced',1);
} elseif ($check > 0) {
$this->log_setTSlogMessage('Indexing needed, reason: '.$this->reasons[$check],1);
} else {
$this->log_setTSlogMessage('Indexing needed, reason: Updates gr_list!',1);
......@@ -1861,18 +1880,8 @@ class tx_indexedsearch_indexer {
*/
function makeCHash($paramArray) {
$addQueryParams = t3lib_div::implodeArrayForUrl('', $paramArray);
$params = explode('&',substr($addQueryParams,1)); // Splitting parameters up
// Make array:
$pA = array();
foreach($params as $theP) {
$pKV = explode('=', $theP); // SPlitting single param by '=' sign
if (!t3lib_div::inList('id,type,no_cache,cHash,MP,ftu',$pKV[0])) {
$pA[$pKV[0]] = (string)rawurldecode($pKV[1]);
}
}
$pA['encryptionKey'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
ksort($pA);
$pA = t3lib_div::cHashParams($addQueryParams);
return t3lib_div::shortMD5(serialize($pA));
}
......@@ -1925,10 +1934,45 @@ class tx_indexedsearch_indexer {
if (is_object($GLOBALS['TT'])) $GLOBALS['TT']->setTSlogMessage($msg,$errorNum);
$this->internal_log[] = $msg;
}
/**************************
*
* tslib_fe hooks:
*
**************************/
/**
* Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!)
*
* @param array Parameters from frontend
* @param object TSFE object (reference under PHP5)
* @return void
*/
function fe_headerNoCache(&$params, $ref) {
// Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction:
if (t3lib_extMgm::isLoaded('crawler')
&& $params['pObj']->applicationData['tx_crawler']['running']
&& in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) {
// Setting simple log entry:
$params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: '.$params['disableAcquireCacheData'];
// Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached.
$params['disableAcquireCacheData'] = TRUE;
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/class.indexer.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/class.indexer.php']);
}
?>
?>
\ No newline at end of file
......@@ -7,9 +7,12 @@ t3lib_extMgm::addTypoScript($_EXTKEY,'editorcfg','
tt_content.CSS_editor.ch.tx_indexedsearch = < plugin.tx_indexedsearch.CSS_editor
',43);
// Attach to hooks:
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = 'EXT:indexed_search/class.indexer.php:tx_indexedsearch_indexer';
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = 'EXT:indexed_search/class.indexer.php:&tx_indexedsearch_indexer->fe_headerNoCache';
// Register with "crawler" extension:
$TYPO3_CONF_VARS['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing';
// Configure default document parsers:
$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['external_parsers'] = array(
......
......@@ -55,6 +55,8 @@ Do you want to continue WITHOUT saving?</label>
<label index="labels.depth_1">1 level</label>
<label index="labels.depth_2">2 levels</label>
<label index="labels.depth_3">3 levels</label>
<label index="labels.depth_4">4 levels</label>
<label index="labels.depth_infi">Infinite</label>
<label index="labels.allow">Allow</label>
<label index="labels.deny">Deny</label>
<label index="labels.generalTab">General</label>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment