Javascript onbeforeunload
2018-04-19
Javascript Event onbeforeunload
is triggered when a page is exited. A browser confirmation dialog is displayed. Here is a function that creates a way to switch the confirmation dialog on and off if required.
Javascript:
/**
* switches eventlistener to onbeforeunload on/off
* @see https://blog.ueffing.net/post/2018/04/19/javascript-onbeforeunload/
* @param boolean bState | default=true (aktiv)
* @returns boolean
*/
fu […]
php: filter double dot und double slash from String
2018-04-15
Code
/**
* @param string $sAbsoluteFilePath
* @return string
*/
function secureFilePath($sAbsoluteFilePath = '')
{
$sAbsoluteFilePath = removeDoubleDotSlashesFromString($sAbsoluteFilePath);
$sAbsoluteFilePath = replaceMultipleForwardSlashesByOneFromString($sAbsoluteFilePath);
/**@var string */
return $sAbsoluteFilePath;
}
/**
* @param string $sString
* @return string
*/
function removeDoubleDotSlashesFromString($sString = '')
{
[…]