]> git.mxchange.org Git - friendica.git/commitdiff
extract private images before bbcode translation since preg has issues with large...
authorfriendica <info@friendica.com>
Sun, 27 Nov 2011 12:09:14 +0000 (04:09 -0800)
committerfriendica <info@friendica.com>
Sun, 27 Nov 2011 12:09:14 +0000 (04:09 -0800)
boot.php
include/bbcode.php
include/diaspora.php

index ff5d238479ea1b052d17c96ba729da409d839411..9d08b752ad63b7bd0245ca1395a523f2e00f5fa4 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1176' );
+define ( 'FRIENDICA_VERSION',      '2.3.1177' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1105      );
 
index 06a610173cb60bce849f8fcd36f570358d123193..71745de5844f331c289a1aece48675190cb1cf29 100644 (file)
@@ -30,6 +30,24 @@ function tryoembed($match){
 
 function bbcode($Text,$preserve_nl = false) {
 
+
+       // extract a single private image which uses data url's since preg has issues with 
+       // large data sizes. Put it back in after we've done all the regex matching.
+       $saved_image = '';
+       $img_start = strpos($Text,'[img]data:');
+       if($img_start !== false) {
+               $start_fragment = substr($Text,0,$img_start);
+               $img_start += strlen('[img]');
+               $saved_image = substr($Text,$img_start);                
+               $img_end = strpos($saved_image,'[/img]');
+               $saved_image = substr($saved_image,0,$img_end);
+               logger('saved_image: ' . $saved_image);
+               $img_end += strlen('[/img]');
+               $Text = $start_fragment . '[$#saved_image#$]' . substr($Text,strlen($start_fragment) + strlen('[img]') + $img_end);
+       }
+
        // If we find any event code, turn it into an event.
        // After we're finished processing the bbcode we'll 
        // replace all of the event code with a reformatted version.
@@ -206,7 +224,9 @@ function bbcode($Text,$preserve_nl = false) {
 
        // fix any escaped ampersands that may have been converted into links
        $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
-       
+       if(strlen($saved_image))
+               $Text = str_replace('[$#saved_image#$]','<img src="' . $saved_image .'" alt="' . t('Image/photo') . '" />',$Text);
+
        call_hooks('bbcode',$Text);
 
        return $Text;
index 36457655e5564738cf0db2e08144065900c3a6e1..0ffb22b956e1fe26a4c2f906a1118b87382a78b3 100644 (file)
@@ -1303,6 +1303,7 @@ function diaspora_retraction($importer,$xml) {
                return;
 
        if($type === 'Person') {
+               require_once('include/Contact.php');
                contact_remove($contact['id']);
        }
        elseif($type === 'Post') {