aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2015-07-15 11:05:07 +0200
committerArthur <arthur@hoa.ro>2015-07-15 11:05:07 +0200
commit874f858b8fbacfcd31cd64e21555f03927d4e15a (patch)
treebe5ad2fcfeb31136e7afca0603a3cd3da3d76b57 /application/Utils.php
parent5b0ebbc5de06b8a0e9679b78b45d0dc755db7986 (diff)
parentd1e2f8e52c931f84c11d4f54f32959710d528182 (diff)
downloadShaarli-874f858b8fbacfcd31cd64e21555f03927d4e15a.tar.gz
Shaarli-874f858b8fbacfcd31cd64e21555f03927d4e15a.tar.zst
Shaarli-874f858b8fbacfcd31cd64e21555f03927d4e15a.zip
Merge pull request #271 from virtualtam/php53
PHP: ensure 5.3 compatibility
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?>