fix space around brackets changing.

This commit is contained in:
friendica 2014-06-19 20:38:38 -07:00
parent 00904d4994
commit 525daa7475
2 changed files with 14 additions and 6 deletions

View File

@ -344,9 +344,15 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$a = get_app(); $a = get_app();
// Move all spaces out of the tags // Move all spaces out of the tags
$Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text); // ....Uhm why?
$Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text); // This is basically doing a trim() on the stuff in between tags, but it messes up
// carefully crafted bbcode and especially other pre-formatted code.
// Commenting out until we come up with a use case where it's needed. Then let's try and
// special case rather than a heavy-handed approach like this.
// $Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text);
// $Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text);
// Hide all [noparse] contained bbtags by spacefying them // Hide all [noparse] contained bbtags by spacefying them
if (strpos($Text,'[noparse]') !== false) { if (strpos($Text,'[noparse]') !== false) {

View File

@ -46,7 +46,7 @@ function item_post(&$a) {
call_hooks('post_local_start', $_REQUEST); call_hooks('post_local_start', $_REQUEST);
logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA); // logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA);
$api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false); $api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false);
@ -376,6 +376,7 @@ function item_post(&$a) {
} }
} }
$expires = '0000-00-00 00:00:00'; $expires = '0000-00-00 00:00:00';
if(feature_enabled($profile_uid,'content_expire')) { if(feature_enabled($profile_uid,'content_expire')) {
@ -396,6 +397,7 @@ function item_post(&$a) {
$body = z_input_filter($profile_uid,$body,$mimetype); $body = z_input_filter($profile_uid,$body,$mimetype);
} }
// Verify ability to use html or php!!! // Verify ability to use html or php!!!
$execflag = false; $execflag = false;
@ -417,6 +419,7 @@ function item_post(&$a) {
} }
} }
if($mimetype === 'text/bbcode') { if($mimetype === 'text/bbcode') {
// BBCODE alert: the following functions assume bbcode input // BBCODE alert: the following functions assume bbcode input
@ -465,7 +468,6 @@ function item_post(&$a) {
$body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$body); $body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$body);
/** /**
* *
* When a photo was uploaded into the message using the (profile wall) ajax * When a photo was uploaded into the message using the (profile wall) ajax
@ -513,6 +515,7 @@ function item_post(&$a) {
$body = scale_external_images($body,false); $body = scale_external_images($body,false);
/** /**
* Look for any tags and linkify them * Look for any tags and linkify them
*/ */
@ -603,7 +606,6 @@ function item_post(&$a) {
// BBCODE end alert // BBCODE end alert
if(strlen($categories)) { if(strlen($categories)) {
$cats = explode(',',$categories); $cats = explode(',',$categories);
foreach($cats as $cat) { foreach($cats as $cat) {