X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fcommon.lib.php;h=e2950753ec4e208475822050253aa0f122cf763b;hb=0cb4a15ec1079fc325845640357dfc75aba0ae23;hp=7086fe298243667a99991461e8236739ae136ddb;hpb=f0e54f23029d8b109c0ab554ab2b49195d204391;p=timetracker.git diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 7086fe29..e2950753 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -165,7 +165,7 @@ function check_extension($ext) // isTrue is a helper function to return correct false for older config.php values defined as a string 'false'. function isTrue($val) { - return ($val == false || $val === 'false') ? false : true; + return (defined($val) && constant($val) === true); } // ttValidString is used to check user input to validate a string. @@ -182,6 +182,15 @@ function ttValidString($val, $emptyValid = false) return true; } +// ttValidTemplateText is used to check template-based user input. +// When templates are used, required input parts must be filled by user. +// We identify these parts by 3 "stop sign" emojis (aka "octagonal sign" U+1F6D1). +function ttValidTemplateText($val) +{ + $valid = strpos($val, '🛑🛑🛑') === false; // no 3 "stop sign" emojis in a row. + return $valid; +} + // ttValidEmail is used to check user input to validate an email string. function ttValidEmail($val, $emptyValid = false) { @@ -226,7 +235,7 @@ function ttValidFloat($val, $emptyValid = false) return ($emptyValid ? true : false); global $user; - $decimal = $user->decimal_mark; + $decimal = $user->getDecimalMark(); if (!preg_match('/^-?[0-9'.$decimal.']+$/', $val)) return false; @@ -319,12 +328,32 @@ function ttValidCondition($val, $emptyValid = true) if (stristr($val, '