diff options
author | nodiscc <nodiscc@gmail.com> | 2015-06-24 01:04:50 +0200 |
---|---|---|
committer | nodiscc <nodiscc@gmail.com> | 2015-06-24 01:08:30 +0200 |
commit | 64bc92e3ac8f5e66d2bc14206ede31e6679d8c13 (patch) | |
tree | 93856d99964edd4109301ada6b028ff33985e470 /index.php | |
parent | eaefcba724e93c5f6b426ad8855ab1af8ac8212a (diff) | |
download | Shaarli-64bc92e3ac8f5e66d2bc14206ede31e6679d8c13.tar.gz Shaarli-64bc92e3ac8f5e66d2bc14206ede31e6679d8c13.tar.zst Shaarli-64bc92e3ac8f5e66d2bc14206ede31e6679d8c13.zip |
move escape() and sanitizeLink() to application/Utils.php
prevents 'PHP Fatal error: Call to undefined function sanitizeLink() in Shaarli/application/LinkDB.php on line 255' in tests
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 17 |
1 files changed, 0 insertions, 17 deletions
@@ -269,23 +269,6 @@ function logm($message) | |||
269 | file_put_contents($GLOBALS['config']['DATADIR'].'/log.txt',$t,FILE_APPEND); | 269 | file_put_contents($GLOBALS['config']['DATADIR'].'/log.txt',$t,FILE_APPEND); |
270 | } | 270 | } |
271 | 271 | ||
272 | // Same as nl2br(), but escapes < and > | ||
273 | function nl2br_escaped($html) | ||
274 | { | ||
275 | return str_replace('>','>',str_replace('<','<',nl2br($html))); | ||
276 | } | ||
277 | |||
278 | function escape($str) { | ||
279 | return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); | ||
280 | } | ||
281 | |||
282 | function sanitizeLink(&$link) { | ||
283 | $link['url'] = escape($link['url']); // useful? | ||
284 | $link['title'] = escape($link['title']); | ||
285 | $link['description'] = escape($link['description']); | ||
286 | $link['tags'] = escape($link['tags']); | ||
287 | } | ||
288 | |||
289 | // In a string, converts URLs to clickable links. | 272 | // In a string, converts URLs to clickable links. |
290 | // Function inspired from http://www.php.net/manual/en/function.preg-replace.php#85722 | 273 | // Function inspired from http://www.php.net/manual/en/function.preg-replace.php#85722 |
291 | function text2clickable($url) | 274 | function text2clickable($url) |