diff options
author | friendica <info@friendica.com> | 2012-06-25 15:34:57 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-06-25 15:34:57 -0700 |
commit | 89ad19ce01f396ca71f4a991699871b26cf90b29 (patch) | |
tree | 7640598f99b1dfddc8a8a77f9ae13f5e438979c2 /include | |
parent | eebb2d2120b91c09238e970b2292059a04960aa7 (diff) | |
parent | d944ff7833355f3bae7befd9c97becf01c4083b1 (diff) | |
download | volse-hubzilla-89ad19ce01f396ca71f4a991699871b26cf90b29.tar.gz volse-hubzilla-89ad19ce01f396ca71f4a991699871b26cf90b29.tar.bz2 volse-hubzilla-89ad19ce01f396ca71f4a991699871b26cf90b29.zip |
Merge https://github.com/friendica/friendica into pull
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 19 | ||||
-rw-r--r-- | include/bb2diaspora.php | 14 | ||||
-rw-r--r-- | include/bbcode.php | 9 | ||||
-rw-r--r-- | include/onepoll.php | 2 |
4 files changed, 24 insertions, 20 deletions
diff --git a/include/api.php b/include/api.php index b77156dfa..cee1fde23 100644 --- a/include/api.php +++ b/include/api.php @@ -565,18 +565,19 @@ if(requestdata('lat') && requestdata('long')) $_REQUEST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long')); $_REQUEST['profile_uid'] = local_user(); - if(requestdata('parent')) +// if(requestdata('parent')) + if($parent) $_REQUEST['type'] = 'net-comment'; else { $_REQUEST['type'] = 'wall'; - if(x($_FILES,'media')) { - // upload the image if we have one - $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo - require_once('mod/wall_upload.php'); - $media = wall_upload_post($a); - if(strlen($media)>0) - $_REQUEST['body'] .= "\n\n".$media; - } + if(x($_FILES,'media')) { + // upload the image if we have one + $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo + require_once('mod/wall_upload.php'); + $media = wall_upload_post($a); + if(strlen($media)>0) + $_REQUEST['body'] .= "\n\n".$media; + } } // set this so that the item_post() function is quiet and doesn't redirect or emit json diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index ac693127b..a0d114a37 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -109,20 +109,22 @@ function bb2diaspora($Text,$preserve_nl = false) { // "<li>" into a deeper nested element until it crashes. So pre-format // the lists as Diaspora lists before sending the $Text to bbcode() // - // Note that regular expressions are really not suitable for parsing - // text with opening and closing tags, so nested lists may make things - // wonky + // Note that to get nested lists to work for Diaspora, we would need + // to define the closing tag for the list elements. So nested lists + // are going to be flattened out in Diaspora for now $endlessloop = 0; - while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) && (++$endlessloop < 20)) { + while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) + (strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) && + (strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) { $Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text); $Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=I\](.*?)\[\/list\]/s", 'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=a\](.*?)\[\/list\]/s", 'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=A\](.*?)\[\/list\]/s", 'diaspora_ol', $Text); + $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text); + $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text); } - $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text); - $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text); // Convert it to HTML - don't try oembed $Text = bbcode($Text, $preserve_nl, false); diff --git a/include/bbcode.php b/include/bbcode.php index f542ad263..38d1e658f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -162,7 +162,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // handle nested lists $endlessloop = 0; - while ((strpos($Text, "[/list]") !== false) and (strpos($Text, "[list") !== false) and (++$endlessloop < 20)) { + while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) + (strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) && + (strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) { $Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text); $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text); @@ -170,11 +172,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '<ul class="listupperroman" style="list-style-type: upper-roman;">$2</ul>' ,$Text); $Text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$2</ul>' ,$Text); $Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$2</ul>' ,$Text); + $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text); + $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text); } - $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text); - $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text); - $Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '<th>$1</th>' ,$Text); $Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '<td>$1</td>' ,$Text); $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/sm", '<tr>$1</tr>' ,$Text); diff --git a/include/onepoll.php b/include/onepoll.php index d68f26883..09e7bb763 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -449,7 +449,7 @@ function onepoll_run($argv, $argc){ if($xml) { logger('poller: received xml : ' . $xml, LOGGER_DATA); - if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) { + if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) { logger('poller: post_handshake: response from ' . $url . ' did not contain XML.'); $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), |