--- /dev/null
- if (Config::get('system', 'maintenance', true)) {
+#!/usr/bin/env php
+<?php
+/**
+ * @file bin/worker.php
+ * @brief Starts the background processing
+ */
+
+use Friendica\App;
+use Friendica\BaseObject;
+use Friendica\Core\Addon;
+use Friendica\Core\Config;
+use Friendica\Core\Worker;
+
+// Ensure that worker.php is executed from the base path of the installation
+if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
+ $directory = dirname($_SERVER["argv"][0]);
+
+ if (substr($directory, 0, 1) != "/") {
+ $directory = $_SERVER["PWD"]."/".$directory;
+ }
+ $directory = realpath($directory."/..");
+
+ chdir($directory);
+}
+
+require_once "boot.php";
+require_once "include/dba.php";
+
+$a = new App(dirname(__DIR__));
+BaseObject::setApp($a);
+
+require_once ".htconfig.php";
+dba::connect($db_host, $db_user, $db_pass, $db_data);
+unset($db_host, $db_user, $db_pass, $db_data);
+
+Config::load();
+
+// Check the database structure and possibly fixes it
+check_db(true);
+
+// Quit when in maintenance
++if (Config::get('system', 'maintenance', false, true)) {
+ return;
+}
+
+$a->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();
+
-- ------------------------------------------
- -- Friendica 3.6-dev (Asparagus)
--- Friendica 3.6-rc (Asparagus)
++-- Friendica 2018-05-dev (Tazmans Flax-lilly)
-- DB_UPDATE_VERSION 1256
-- ------------------------------------------
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;
}
if ($data["description"] != "" && $data["description"] != $data["title"]) {
- $return .= sprintf('<blockquote>%s</blockquote>', trim(self::convert($data["description"])));
+ // Sanitize the HTML by converting it to BBCode
- $bbcode = html2bbcode($data["description"]);
++ $bbcode = HTML::toBBCode($data["description"]);
+ $return .= sprintf('<blockquote>%s</blockquote>', trim(self::convert($bbcode)));
}
-
if ($data["type"] == "link") {
$return .= sprintf('<sup><a href="%s">%s</a></sup>', $data['url'], parse_url($data['url'], PHP_URL_HOST));
}
$doc = new DOMDocument();
@$doc->loadHTML($body);
-- $xpath = new DomXPath($doc);
++ $xpath = new DOMXPath($doc);
$list = $xpath->query("//meta[@name]");
foreach ($list as $node) {
$attr = [];
$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;
}
// 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'])) {