From e411a4bdc27cd443abf613a0044effb4604223f0 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 14 Apr 2013 20:41:58 -0700 Subject: IMPORTANT: magic-auth protocol update, plus 'zrl' bbcode tag for the privacy-is-more-important-than-ease-of-use folks. --- include/bbcode.php | 15 +++++++++------ include/text.php | 29 +++++++++++++++++++++++++++++ mod/post.php | 12 +++++++++++- util/messages.po | 8 ++++---- version.inc | 2 +- 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 82d25ffc8..930337c5d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -263,21 +263,24 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // Perform URL Search - $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text); + $urlchars = '[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]'; - if ($tryoembed) - $Text = preg_replace_callback("/\[bookmark\=([^\]]*)\].*?\[\/bookmark\]/ism",'tryoembed',$Text); - $Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$Text); + $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)/ism", '$1$2', $Text); + +// $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)\{zid\}($urlchars*)/ism", '$1$2$3', $Text); $Text = preg_replace_callback("/\[share(.*?)\](.*?)\[\/share\]/ism","bb_ShareAttributes",$Text); - if ($tryoembed) + if($tryoembed) $Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism",'tryoembed',$Text); $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text); $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text); - //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '$2', $Text); + + + $Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '$1', $Text); + $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '$2', $Text); // Perform MAIL Search $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text); diff --git a/include/text.php b/include/text.php index a8d91fade..f0251494d 100644 --- a/include/text.php +++ b/include/text.php @@ -1108,6 +1108,7 @@ function prepare_text($text,$content_type = 'text/bbcode') { $s = bbcode($text); else $s = smilies(bbcode($text)); + $s = zidify_links($s); break; } @@ -1115,6 +1116,34 @@ function prepare_text($text,$content_type = 'text/bbcode') { } +/** + * zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links + * These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode() + * because the latter is used for general purpose conversions and the former is used only when preparing text for + * immediate display. + * + * Issues: Currently the order of HTML parameters in the text is somewhat rigid and inflexible. + * We assume it looks like and will not work if zrl and href appear in a different order. + */ + + +function zidify_callback($match) { + $replace = '\n" "Language-Team: LANGUAGE \n" @@ -3546,7 +3546,7 @@ msgid "View Connnections" msgstr "" #: ../../mod/chanview.php:74 ../../mod/wall_upload.php:35 -#: ../../mod/magic.php:59 ../../mod/page.php:21 +#: ../../mod/magic.php:58 ../../mod/page.php:21 msgid "Channel not found." msgstr "" @@ -3592,13 +3592,13 @@ msgstr "" msgid "Wall Photos" msgstr "" -#: ../../mod/post.php:107 +#: ../../mod/post.php:114 msgid "" "Remote authentication blocked. You are logged into this site locally. Please " "logout and retry." msgstr "" -#: ../../mod/post.php:117 +#: ../../mod/post.php:124 #, php-format msgid "Welcome %s. Remote authentication successful." msgstr "" diff --git a/version.inc b/version.inc index b3cdee116..c23d387ab 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-04-10.279 +2013-04-14.283 -- cgit v1.2.3