]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #355 from ArthurHoaro/redirector-url
authorVirtualTam <virtualtam@flibidi.net>
Thu, 26 Nov 2015 22:05:58 +0000 (23:05 +0100)
committerVirtualTam <virtualtam@flibidi.net>
Thu, 26 Nov 2015 22:05:58 +0000 (23:05 +0100)
URL encode links when a redirector is set

1  2 
index.php

diff --cc index.php
index bb00c11d2613b231dae6c4196d70eb8c3861ab62,62d29f2c34e5b7a0c835ca5971f71911c95c5b66..3954be973fa6db33a06f930d775b1098f7f5bce2
+++ b/index.php
@@@ -337,24 -337,9 +337,9 @@@ function checkUpdate(
  function logm($message)
  {
      $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
 -    file_put_contents($GLOBAL['config']['LOG_FILE'], $t, FILE_APPEND);
 +    file_put_contents($GLOBALS['config']['LOG_FILE'], $t, FILE_APPEND);
  }
  
- // In a string, converts URLs to clickable links.
- // Function inspired from http://www.php.net/manual/en/function.preg-replace.php#85722
- function text2clickable($url)
- {
-     $redir = empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector'];
-     return preg_replace('!(((?:https?|ftp|file)://|apt:|magnet:)\S+[[:alnum:]]/?)!si','<a href="'.$redir.'$1" rel="nofollow">$1</a>',$url);
- }
- // This function inserts &nbsp; where relevant so that multiple spaces are properly displayed in HTML
- // even in the absence of <pre>  (This is used in description to keep text formatting)
- function keepMultipleSpaces($text)
- {
-     return str_replace('  ',' &nbsp;',$text);
- }
  // ------------------------------------------------------------------------------------------
  // Sniff browser language to display dates in the right format automatically.
  // (Note that is may not work on your server if the corresponding local is not installed.)