'field' => $field,
'title' => $fieldTitle
)));
+ $hash = t3lib_div::hmac($params);
+ $params .= $hash;
$aOnClick = 'vHWin=window.open(\'' . $this->backPath . 'view_help.php?ffID=' . $params . '\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
return '<a href="#" class="typo3-csh-link" onclick="' . htmlspecialchars($aOnClick) . '">' .
t3lib_iconWorks::getSpriteIcon('actions-system-help-open') . $hoverText .
$this->tfID = '';
}
if (!$this->tfID) {
- if (($this->ffID = t3lib_div::_GP('ffID'))) {
- $this->ffID = unserialize(base64_decode($this->ffID));
+ $ffID = t3lib_div::_GP('ffID');
+ if (!empty($ffID)) {
+ $this->ffID = unserialize(base64_decode($this->validateAndStripHmac($ffID)));
}
}
$this->back = t3lib_div::_GP('back');
}
/**
+ * @param $string
+ * @return string
+ * @throws InvalidArgumentException
+ */
+ protected function validateAndStripHmac($string) {
+ if (!is_string($string)) {
+ throw new InvalidArgumentException('A hash can only be validated for a string, but "' . gettype($string) . '" was given.', 1320829762);
+ }
+ if (strlen($string) < 40) {
+ throw new InvalidArgumentException('A hashed string must contain at least 40 characters, the given string was only ' . strlen($string) . ' characters long.', 1320830276);
+ }
+ $stringWithoutHmac = substr($string, 0, -40);
+ if (t3lib_div::hmac($stringWithoutHmac) !== substr($string, -40)) {
+ throw new InvalidArgumentException('The given string was not appended with a valid HMAC.', 1320830018);
+ }
+ return $stringWithoutHmac;
+
+ }
+
+ /**
* Main function, rendering the display
*
* @return void
$SOBE->main();
$SOBE->printContent();
-?>
\ No newline at end of file
+?>