From: Hypolite Petovan Date: Fri, 23 Mar 2018 10:15:55 +0000 (-0400) Subject: Merge branch 'master' into develop X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=27d94023eef0263a3ce9750f79a73ac941a25304;p=friendica.git Merge branch 'master' into develop --- 27d94023eef0263a3ce9750f79a73ac941a25304 diff --cc bin/worker.php index 67f9fed1a5,0000000000..b4b265283c mode 100644,000000..100644 --- a/bin/worker.php +++ b/bin/worker.php @@@ -1,66 -1,0 +1,66 @@@ +#!/usr/bin/env php +set_baseurl(Config::get('system', 'url')); + +Addon::loadHooks(); + +$spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn")); + +if ($spawn) { + Worker::spawnWorker(); + killme(); +} + +$run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron")); + +Worker::processQueue($run_cron); + +Worker::unclaimProcess(); + +Worker::endProcess(); + +killme(); + diff --cc database.sql index 0b2b017075,181e9e804a..591569ad5f --- a/database.sql +++ b/database.sql @@@ -1,5 -1,5 +1,5 @@@ -- ------------------------------------------ - -- Friendica 3.6-dev (Asparagus) --- Friendica 3.6-rc (Asparagus) ++-- Friendica 2018-05-dev (Tazmans Flax-lilly) -- DB_UPDATE_VERSION 1256 -- ------------------------------------------ diff --cc src/Content/Text/BBCode.php index 1148103054,13d4e1b055..82c6f46980 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@@ -7,11 -5,11 +7,11 @@@ namespace Friendica\Content\Text; use DOMDocument; --use DomXPath; ++use DOMXPath; use Exception; +use Friendica\BaseObject; use Friendica\Content\OEmbed; use Friendica\Content\Smilies; -use Friendica\Content\Text\Plaintext; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; @@@ -708,9 -706,10 +708,10 @@@ class BBCode extends BaseObjec } if ($data["description"] != "" && $data["description"] != $data["title"]) { - $return .= sprintf('
%s
', trim(self::convert($data["description"]))); + // Sanitize the HTML by converting it to BBCode - $bbcode = html2bbcode($data["description"]); ++ $bbcode = HTML::toBBCode($data["description"]); + $return .= sprintf('
%s
', trim(self::convert($bbcode))); } - if ($data["type"] == "link") { $return .= sprintf('%s', $data['url'], parse_url($data['url'], PHP_URL_HOST)); } @@@ -1207,7 -1220,7 +1201,7 @@@ $doc = new DOMDocument(); @$doc->loadHTML($body); -- $xpath = new DomXPath($doc); ++ $xpath = new DOMXPath($doc); $list = $xpath->query("//meta[@name]"); foreach ($list as $node) { $attr = []; diff --cc src/Protocol/Diaspora.php index 0055f8d9ba,cc4b230831..dd21058496 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@@ -3591,16 -3613,24 +3614,24 @@@ class Diaspor $eventdata['end'] = DateTimeFormat::convert($event['finish'], "UTC", $eventdata['timezone'], $mask); } if ($event['summary']) { - $eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary'])); + $eventdata['summary'] = html_entity_decode(BBCode::toMarkdown($event['summary'])); } if ($event['desc']) { - $eventdata['description'] = html_entity_decode(bb2diaspora($event['desc'])); + $eventdata['description'] = html_entity_decode(BBCode::toMarkdown($event['desc'])); } if ($event['location']) { + $event['location'] = preg_replace("/\[map\](.*?)\[\/map\]/ism", '$1', $event['location']); + $coord = Map::getCoordinates($event['location']); + $location = []; - $location["address"] = html_entity_decode(bb2diaspora($event['location'])); + $location["address"] = html_entity_decode(BBCode::toMarkdown($event['location'])); - $location["lat"] = 0; - $location["lng"] = 0; + if (!empty($coord['lat']) && !empty($coord['lon'])) { + $location["lat"] = $coord['lat']; + $location["lng"] = $coord['lon']; + } else { + $location["lat"] = 0; + $location["lng"] = 0; + } $eventdata['location'] = $location; } diff --cc src/Protocol/OStatus.php index fd53772fd7,bf0cca90c2..602d178bce --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@@ -658,8 -660,9 +660,9 @@@ class OStatu // Mastodon Content Warning if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) { $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; - - $item["body"] = HTML::toBBCode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]'; + if (!empty($clear_text)) { - $item['content-warning'] = html2bbcode($clear_text); ++ $item['content-warning'] = HTML::toBBCode($clear_text); + } } if (($self != '') && empty($item['protocol'])) {