]> git.mxchange.org Git - friendica.git/commitdiff
more readable private image extraction for bypassing preg limits
authorfriendica <info@friendica.com>
Sun, 27 Nov 2011 21:44:45 +0000 (13:44 -0800)
committerfriendica <info@friendica.com>
Sun, 27 Nov 2011 21:44:45 +0000 (13:44 -0800)
boot.php
include/bbcode.php

index 9d08b752ad63b7bd0245ca1395a523f2e00f5fa4..01280c42f46b1735bba7c5473e3a6cccb4dcdefe 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.1177' );
+define ( 'FRIENDICA_VERSION',      '2.3.1178' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1105      );
 
index 71745de5844f331c289a1aece48675190cb1cf29..1ad81d26ff4c0cdb285cf8fdf7a8f767298e96ca 100644 (file)
@@ -36,16 +36,15 @@ function bbcode($Text,$preserve_nl = false) {
  
        $saved_image = '';
        $img_start = strpos($Text,'[img]data:');
-       if($img_start !== false) {
+       $img_end = strpos($Text,'[/img]');
+
+       if($img_start !== false && $img_end !== false && $img_end > $img_start) {
                $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);
+               $saved_image = substr($Text,$img_start,strpos($Text,'[/img]'));
+               $end_fragment = substr($Text,$img_end + strlen('[/img]'));              
+//             logger('saved_image: ' . $saved_image,LOGGER_DEBUG);
+               $Text = $start_fragment . '[$#saved_image#$]' . $end_fragment;
        }
 
        // If we find any event code, turn it into an event.