aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/application/Utils.php b/application/Utils.php
index 658b97bc..cd4724fa 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -48,7 +48,7 @@ function endsWith($haystack, $needle, $case=true)
48 */ 48 */
49function nl2br_escaped($html) 49function nl2br_escaped($html)
50{ 50{
51 return str_replace('>','&gt;',str_replace('<','&lt;',nl2br($html))); 51 return str_replace('>', '&gt;', str_replace('<', '&lt;', nl2br($html)));
52} 52}
53 53
54/** 54/**
@@ -117,3 +117,24 @@ function generateLocation($referer, $host, $loopTerms = array())
117 117
118 return $final_referer; 118 return $final_referer;
119} 119}
120
121/**
122 * Checks the PHP version to ensure Shaarli can run
123 *
124 * @param string $minVersion minimum PHP required version
125 * @param string $curVersion current PHP version (use PHP_VERSION)
126 *
127 * @throws Exception the PHP version is not supported
128 */
129function checkPHPVersion($minVersion, $curVersion)
130{
131 if (version_compare($curVersion, $minVersion) < 0) {
132 throw new Exception(
133 'Your PHP version is obsolete!'
134 .' Shaarli requires at least PHP '.$minVersion.', and thus cannot run.'
135 .' Your PHP version has known security vulnerabilities and should be'
136 .' updated as soon as possible.'
137 );
138 }
139}
140?>