Project

General

Profile

Bug #17251 » class.tslib_fe.php.diff

Administrator Admin, 2007-04-30 14:59

View differences:

class.tslib_fe.php (working copy)
* @see reqCHash()
*/
function makeCacheHash() {
/* Declare */
$GET = t3lib_div::_GET();
if ($this->cHash && is_array($GET)) {
$this->cHash_array = t3lib_div::cHashParams(t3lib_div::implodeArrayForUrl('',$GET));
$cHash_calc = t3lib_div::shortMD5(serialize($this->cHash_array));
$cHashNeeded = false;
$this->cHash_array = t3lib_div::cHashParams(t3lib_div::implodeArrayForUrl('',$GET));
$cHash_calc = t3lib_div::shortMD5(serialize($cHash_array)); // Calculating the correct cHash
if ($cHash_calc!=$this->cHash) {
if ($this->TYPO3_CONF_VARS['FE']['pageNotFoundOnCHashError']) {
$this->pageNotFoundAndExit('Request parameters could not be validated (&cHash comparison failed)');
} else {
$this->set_no_cache();
$GLOBALS['TT']->setTSlogMessage('The incoming cHash "'.$this->cHash.'" and calculated cHash "'.$cHash_calc.'" did not match, so caching was disabled. The fieldlist used was "'.implode(',',array_keys($this->cHash_array)).'"',2);
}
/* Begin */
if ((count($this->cHash_array) == 1) && isset($this->cHash_array['encryptionKey'])) {
//We have only 1 key, and it's 'encryptionKey', also all GET parameters are TYPO3 reserved variables -> no cHash needed
$cHashNeeded = false;
//Reset cHash_array
$this->cHash_array = array();
} elseif ((count($this->cHash_array) == 2) && isset($this->cHash_array['']) && isset($this->cHash_array['encryptionKey'])) {
//If we have only 2 keys, and theses two keys are '' and 'encryptionKey', then whe are sure that we have NO _GET parameters
$cHashNeeded = false;
//Reset cHash_array
$this->cHash_array = array();
} else {
//Here we need a correct cHash
$cHashNeeded = true;
}
//*** Checks cHash needed against cHash found, and compare it (a missing cHash or a useless cHash is WRONG)
if (($cHashNeeded XOR $this->cHash) || strcmp($cHash_calc, $this->cHash)) {
if ($this->TYPO3_CONF_VARS['FE']['pageNotFoundOnCHashError']) {
$this->pageNotFoundAndExit('Request parameters could not be validated (&cHash comparison failed)');
} else {
$this->set_no_cache();
$GLOBALS['TT']->setTSlogMessage('The incoming cHash "'.$this->cHash.'" and calculated cHash "'.$cHash_calc.'" did not match, so caching was disabled. The fieldlist used was "'.implode(',',array_keys($this->cHash_array)).'"',2);
}
}
}
/**
(2-2/2)