*/
function nl2br_escaped($html)
{
- return str_replace('>','>',str_replace('<','<',nl2br($html)));
+ return str_replace('>', '>', str_replace('<', '<', nl2br($html)));
}
/**
return $final_referer;
}
+
+/**
+ * Checks the PHP version to ensure Shaarli can run
+ *
+ * @param string $minVersion minimum PHP required version
+ * @param string $curVersion current PHP version (use PHP_VERSION)
+ *
+ * @throws Exception the PHP version is not supported
+ */
+function checkPHPVersion($minVersion, $curVersion)
+{
+ if (version_compare($curVersion, $minVersion) < 0) {
+ throw new Exception(
+ 'Your PHP version is obsolete!'
+ .' Shaarli requires at least PHP '.$minVersion.', and thus cannot run.'
+ .' Your PHP version has known security vulnerabilities and should be'
+ .' updated as soon as possible.'
+ );
+ }
+}
+?>