]> git.mxchange.org Git - friendica.git/commitdiff
diaspora2bb, salmon fix argument error
authorFriendika <info@friendika.com>
Thu, 25 Aug 2011 23:37:27 +0000 (16:37 -0700)
committerFriendika <info@friendika.com>
Thu, 25 Aug 2011 23:37:27 +0000 (16:37 -0700)
boot.php
include/bb2diaspora.php
include/diaspora.php
include/salmon.php

index eddcdf1530b6038e54b1910c2d2167ef4d376904..e897f19aa12b21151bf8eb0d1f61e536da0fd8e1 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -7,7 +7,7 @@ require_once('include/text.php');
 require_once("include/pgettext.php");
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.1082' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1083' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1082      );
 
index 5ce34d6660a955237b18ea0f925c66372f22c514..7f7b8748d38d42a5e1a02d4410491a47a5f32f67 100644 (file)
@@ -5,6 +5,25 @@ require_once('include/event.php');
 
 
 
+
+function diaspora2bb($s) {
+
+       $s = str_replace(array('\\**','\\__','\\*','\\_'), array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'),$s);
+       $s = preg_replace("/\*\*\*(.+?)\*\*\*/", '[b][i]$1[/i][/b]', $s);
+       $s = preg_replace("/\_\_\_(.+?)\_\_\_/", '[b][i]$1[/i][/b]', $s);
+       $s = preg_replace("/\*\*(.+?)\*\*/", '[b]$1[/b]', $s);
+       $s = preg_replace("/\_\_(.+?)\_\_/", '[b]$1[/b]', $s);
+       $s = preg_replace("/\*(.+?)\*/", '[i]$1[/i]', $s);
+       $s = preg_replace("/\_(.+?)\_/", '[i]$1[/i]', $s);
+       $s = str_replace(array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'), array('**','__','*','_'), $s);
+       $s = preg_replace('/\[(.+?)\]\((.+?)\)/','[url=$2]$1[/url]',$s);
+
+       $s = escape_tags($s);
+       return $s;
+
+}
+
+
 function stripdcode_br_cb($s) {
        return '[code]' . str_replace('<br />', '', $s[1]) . '[/code]';
 }
index 75d47e05aa5902ed9bf9c9d1f4c5c5fc929b1469..90c802363c98bee8fcb87e446dc6aee62a6d7e95 100644 (file)
@@ -435,32 +435,7 @@ function diaspora_post($importer,$xml) {
        $created = unxmlify($xml->created_at);
        $private = ((unxmlify($xml->public) == 'false') ? 1 : 0);
 
-       $body = unxmlify($xml->raw_message);
-
-       require_once('library/HTMLPurifier.auto.php');
-       require_once('include/html2bbcode.php');
-
-       $maxlen = get_max_import_size();
-       if($maxlen && (strlen($body) > $maxlen))
-               $body = substr($body,0, $maxlen);
-
-       if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
-
-               $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
-                       '[youtube]$1[/youtube]', $body);
-
-               $body = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
-                       '[youtube]$1[/youtube]', $body);
-
-               $body = oembed_html2bbcode($body);
-
-               $config = HTMLPurifier_Config::createDefault();
-               $config->set('Cache.DefinitionImpl', null);
-               $purifier = new HTMLPurifier($config);
-               $body = $purifier->purify($body);
-
-               $body = html2bbcode($body);
-       }
+       $body = diaspora2bb($xml->raw_message);
 
        $datarray = array();
        $datarray['uid'] = $importer['uid'];
@@ -558,32 +533,7 @@ function diaspora_comment($importer,$xml,$msg) {
 
        // Phew! Everything checks out. Now create an item.
 
-       require_once('library/HTMLPurifier.auto.php');
-       require_once('include/html2bbcode.php');
-
-       $body = $text;
-
-       $maxlen = get_max_import_size();
-       if($maxlen && (strlen($body) > $maxlen))
-               $body = substr($body,0, $maxlen);
-
-       if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
-
-               $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
-                       '[youtube]$1[/youtube]', $body);
-
-               $body = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
-                       '[youtube]$1[/youtube]', $body);
-
-               $body = oembed_html2bbcode($body);
-
-               $config = HTMLPurifier_Config::createDefault();
-               $config->set('Cache.DefinitionImpl', null);
-               $purifier = new HTMLPurifier($config);
-               $body = $purifier->purify($body);
-
-               $body = html2bbcode($body);
-       }
+       $body = diaspora2bb($text);
 
        $message_id = $diaspora_handle . ':' . $guid;
 
index ba61fffccaaa3f372abeb4b1a69864dd1f980bd2..9153f8994ce9ccff52c4d546e41fb65795df7de0 100644 (file)
@@ -109,11 +109,11 @@ EOT;
 
        $precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng==';
 
-       $signature   = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),true),$owner['sprvkey']);
+       $signature   = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['sprvkey']));
 
-       $signature2  = base64url_encode(rsa_sign($data . $precomputed),$owner['sprvkey']);
+       $signature2  = base64url_encode(rsa_sign($data . $precomputed,$owner['sprvkey']));
 
-       $signature3  = base64url_encode(rsa_sign($data),$owner['sprvkey']);
+       $signature3  = base64url_encode(rsa_sign($data,$owner['sprvkey']));
 
        $salmon_tpl = get_markup_template('magicsig.tpl');