]> git.mxchange.org Git - friendica.git/commitdiff
handle multiple underscores in D* links
authorfriendica <info@friendica.com>
Sun, 27 May 2012 06:46:42 +0000 (23:46 -0700)
committerfriendica <info@friendica.com>
Sun, 27 May 2012 06:46:42 +0000 (23:46 -0700)
include/auth.php
include/bb2diaspora.php

index b87662fea29f55944d5744768ba09d87705ca070..cba6a67a7fd7ec5124b919540bc3b6bf118013cc 100644 (file)
@@ -53,6 +53,8 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                $check = get_config('system','paranoia');
                // extra paranoia - if the IP changed, log them out
                if($check && ($_SESSION['addr'] != $_SERVER['REMOTE_ADDR'])) {
+                       logger('Session address changed. Paranoid setting in effect, blocking session. ' 
+                               . $_SESSION['addr'] . ' != ' . $_SERVER['REMOTE_ADDR']);
                        nuke_session();
                        goaway(z_root());
                }
index 8487f845a62848a75750632f14b773047096dbde..d86ba454375b72cdb481c6a5da845028e90e3502 100644 (file)
@@ -221,13 +221,18 @@ function bb2diaspora($Text,$preserve_nl = false) {
 
        $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
 
-       $Text = preg_replace('/\[(.*?)\]\((.*?)\\\\_(.*?)\)/ism','[$1]($2_$3)',$Text);
+       $Text = preg_replace_callback('/\[(.*?)\]\((.*?)\)/ism','unescape_underscores_in_links',$Text);
        
        call_hooks('bb2diaspora',$Text);
 
        return $Text;
 }
 
+function unescape_underscores_in_links($m) {
+       $y = str_replace('\\_','_', $m[2]);
+       return('[' . $m[1] . '](' . $y . ')');
+}
+
 function format_event_diaspora($ev) {
 
        $a = get_app();