commit
7211fc4f1a
23 changed files with 193 additions and 135 deletions
|
@ -579,7 +579,9 @@ function api_get_user(App $a, $contact_id = null)
|
|||
// $called_api is the API path exploded on / and is expected to have at least 2 elements
|
||||
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) {
|
||||
$argid = count($called_api);
|
||||
if (!empty($a->argv[$argid])) {
|
||||
list($user, $null) = explode(".", $a->argv[$argid]);
|
||||
}
|
||||
if (is_numeric($user)) {
|
||||
$user = dbesc(api_unique_id_to_nurl(intval($user)));
|
||||
|
||||
|
|
|
@ -721,6 +721,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
|
|||
continue;
|
||||
}
|
||||
|
||||
/// @todo Check if this call is needed or not
|
||||
$arr = ['item' => $item];
|
||||
Addon::callHooks('display_item', $arr);
|
||||
|
||||
$item['pagedrop'] = $page_dropping;
|
||||
|
|
|
@ -65,13 +65,13 @@ function display_init(App $a)
|
|||
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $a->argv[2], 'private' => false, 'uid' => 0]);
|
||||
}
|
||||
|
||||
if (!DBM::is_result($item) || $item['deleted']) {
|
||||
if (!DBM::is_result($item)) {
|
||||
$a->error = 404;
|
||||
notice(L10n::t('Item not found.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
|
||||
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
|
||||
logger('Directly serving XML for id '.$item["id"], LOGGER_DEBUG);
|
||||
displayShowFeed($item["id"], false);
|
||||
}
|
||||
|
@ -347,19 +347,20 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
Item::update(['unseen' => false], $condition);
|
||||
}
|
||||
|
||||
$items = conv_sort(Item::inArray($items_obj), "`commented`");
|
||||
$items = Item::inArray($items_obj);
|
||||
$conversation_items = conv_sort($items, "`commented`");
|
||||
|
||||
if (!$update) {
|
||||
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>";
|
||||
}
|
||||
$o .= conversation($a, $items, 'display', $update_uid, false, 'commented', local_user());
|
||||
$o .= conversation($a, $conversation_items, 'display', $update_uid, false, 'commented', local_user());
|
||||
|
||||
// Preparing the meta header
|
||||
$description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true));
|
||||
$title = trim(HTML::toPlaintext(BBCode::convert($s[0]["title"], false), 0, true));
|
||||
$author_name = $s[0]["author-name"];
|
||||
$description = trim(HTML::toPlaintext(BBCode::convert($items[0]["body"], false), 0, true));
|
||||
$title = trim(HTML::toPlaintext(BBCode::convert($items[0]["title"], false), 0, true));
|
||||
$author_name = $items[0]["author-name"];
|
||||
|
||||
$image = $a->remove_baseurl($s[0]["author-thumb"]);
|
||||
$image = $a->remove_baseurl($items[0]["author-avatar"]);
|
||||
|
||||
if ($title == "") {
|
||||
$title = $author_name;
|
||||
|
@ -391,7 +392,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
$a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$s[0]["plink"].'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$items[0]["plink"].'" />'."\n";
|
||||
|
||||
// Dublin Core
|
||||
$a->page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
|
||||
|
@ -401,7 +402,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
$a->page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta property="og:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$s[0]["plink"].'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$items[0]["plink"].'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
|
||||
$a->page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";
|
||||
// article:tag
|
||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Database\DBM;
|
|||
|
||||
function friendica_init(App $a)
|
||||
{
|
||||
if ($a->argv[1] == "json") {
|
||||
if (!empty($a->argv[1]) && ($a->argv[1] == "json")) {
|
||||
$register_policy = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'];
|
||||
|
||||
$sql_extra = '';
|
||||
|
|
|
@ -699,9 +699,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$order_mode = 'commented';
|
||||
}
|
||||
|
||||
if ($sql_order == '') {
|
||||
$sql_order = "$sql_table.$ordering";
|
||||
}
|
||||
|
||||
if (x($_GET, 'offset')) {
|
||||
$sql_range = sprintf(" AND $sql_order <= '%s'", dbesc($_GET['offset']));
|
||||
|
|
|
@ -130,7 +130,7 @@ function ping_init(App $a)
|
|||
|
||||
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
|
||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
|
||||
$params = ['order' => ['created' => true]];
|
||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||
|
||||
|
@ -487,7 +487,7 @@ function ping_get_notifications($uid)
|
|||
|
||||
if ($notification["visible"]
|
||||
&& !$notification["deleted"]
|
||||
&& !(x($result, $notification["parent"]) && is_array($result[$notification["parent"]]))
|
||||
&& !(x($result, $notification["parent"]) && !empty($result[$notification["parent"]]))
|
||||
) {
|
||||
// Should we condense the notifications or show them all?
|
||||
if (PConfig::get(local_user(), 'system', 'detailed_notif')) {
|
||||
|
|
15
mod/poco.php
15
mod/poco.php
|
@ -31,7 +31,7 @@ function poco_init(App $a) {
|
|||
$system_mode = true;
|
||||
}
|
||||
|
||||
$format = (($_GET['format']) ? $_GET['format'] : 'json');
|
||||
$format = defaults($_GET, 'format', 'json');
|
||||
|
||||
$justme = false;
|
||||
$global = false;
|
||||
|
@ -76,11 +76,11 @@ function poco_init(App $a) {
|
|||
|
||||
if ($justme) {
|
||||
$sql_extra = " AND `contact`.`self` = 1 ";
|
||||
} else {
|
||||
$sql_extra = "";
|
||||
}
|
||||
// else
|
||||
// $sql_extra = " AND `contact`.`self` = 0 ";
|
||||
|
||||
if ($cid) {
|
||||
if (!empty($cid)) {
|
||||
$sql_extra = sprintf(" AND `contact`.`id` = %d ", intval($cid));
|
||||
}
|
||||
if (x($_GET, 'updatedSince')) {
|
||||
|
@ -112,8 +112,9 @@ function poco_init(App $a) {
|
|||
} else {
|
||||
$totalResults = 0;
|
||||
}
|
||||
if (!empty($_GET['startIndex'])) {
|
||||
$startIndex = intval($_GET['startIndex']);
|
||||
if (! $startIndex) {
|
||||
} else {
|
||||
$startIndex = 0;
|
||||
}
|
||||
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
|
||||
|
@ -204,6 +205,10 @@ function poco_init(App $a) {
|
|||
if (is_array($contacts)) {
|
||||
if (DBM::is_result($contacts)) {
|
||||
foreach ($contacts as $contact) {
|
||||
if (!isset($contact['updated'])) {
|
||||
$contact['updated'] = '';
|
||||
}
|
||||
|
||||
if (! isset($contact['generation'])) {
|
||||
if ($global) {
|
||||
$contact['generation'] = 3;
|
||||
|
|
|
@ -43,9 +43,7 @@ function receive_post(App $a)
|
|||
|
||||
logger('mod-diaspora: receiving post', LOGGER_DEBUG);
|
||||
|
||||
$xml = urldecode($_POST['xml']);
|
||||
|
||||
if (!$xml) {
|
||||
if (empty($_POST['xml'])) {
|
||||
$postdata = file_get_contents("php://input");
|
||||
if ($postdata == '') {
|
||||
System::httpExit(500);
|
||||
|
@ -54,6 +52,8 @@ function receive_post(App $a)
|
|||
logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
|
||||
$msg = Diaspora::decodeRaw($importer, $postdata);
|
||||
} else {
|
||||
$xml = urldecode($_POST['xml']);
|
||||
|
||||
logger('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
|
||||
$msg = Diaspora::decode($importer, $xml);
|
||||
|
||||
|
|
|
@ -571,9 +571,9 @@ class BBCode extends BaseObject
|
|||
$return = sprintf('<div class="type-%s">', $data["type"]);
|
||||
}
|
||||
|
||||
if ($data["image"] != "") {
|
||||
if (!empty($data["image"])) {
|
||||
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], self::proxyUrl($data["image"], $simplehtml), $data["title"]);
|
||||
} elseif ($data["preview"] != "") {
|
||||
} elseif (!empty($data["preview"])) {
|
||||
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], self::proxyUrl($data["preview"], $simplehtml), $data["title"]);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,6 +144,10 @@ class L10n
|
|||
{
|
||||
$a = get_app();
|
||||
|
||||
if (empty($s)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (x($a->strings, $s)) {
|
||||
$t = $a->strings[$s];
|
||||
$s = is_array($t) ? $t[0] : $t;
|
||||
|
|
|
@ -152,12 +152,8 @@ EOT;
|
|||
|
||||
if (isset($description["title"])) {
|
||||
$tpl = get_markup_template('http_status.tpl');
|
||||
echo replace_macros(
|
||||
$tpl,
|
||||
[
|
||||
'$title' => $description["title"],
|
||||
'$description' => $description["description"]]
|
||||
);
|
||||
echo replace_macros($tpl, ['$title' => $description["title"],
|
||||
'$description' => defaults($description, 'description', '')]);
|
||||
}
|
||||
|
||||
killme();
|
||||
|
|
|
@ -662,6 +662,11 @@ class GContact
|
|||
$last_failure_str = '';
|
||||
$last_contact_str = '';
|
||||
|
||||
if (empty($contact["network"])) {
|
||||
logger("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_array($contact["network"], [NETWORK_PHANTOM])) {
|
||||
logger("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
|
||||
return false;
|
||||
|
|
|
@ -51,7 +51,7 @@ class Item extends BaseObject
|
|||
'attach', 'tag', 'bookmark', 'deleted', 'extid',
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||
'author-id', 'author-link', 'owner-link', 'contact-uid',
|
||||
'signed_text', 'signature', 'signer'];
|
||||
'signed_text', 'signature', 'signer', 'network'];
|
||||
|
||||
// Field list for "item-content" table that is mixed with the item table
|
||||
const MIXED_CONTENT_FIELDLIST = ['title', 'content-warning', 'body', 'location',
|
||||
|
@ -1030,10 +1030,8 @@ class Item extends BaseObject
|
|||
|
||||
private static function guid($item, $notify)
|
||||
{
|
||||
$guid = notags(trim($item['guid']));
|
||||
|
||||
if (!empty($guid)) {
|
||||
return $guid;
|
||||
if (!empty($item['guid'])) {
|
||||
return notags(trim($item['guid']));
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
|
|
|
@ -112,7 +112,7 @@ class Profile
|
|||
}
|
||||
}
|
||||
|
||||
$pdata = self::getByNickname($nickname, $user[0]['uid'], $profile);
|
||||
$pdata = self::getByNickname($nickname, $user['uid'], $profile);
|
||||
|
||||
if (empty($pdata) && empty($profiledata)) {
|
||||
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
|
||||
|
|
|
@ -356,8 +356,8 @@ class Post extends BaseObject
|
|||
'guid' => urlencode($item['guid']),
|
||||
'isevent' => $isevent,
|
||||
'attend' => $attend,
|
||||
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, defaults($item, 'author-link', $item['url'])),
|
||||
'olinktitle' => L10n::t('View %s\'s profile @ %s', htmlentities($this->getOwnerName()), defaults($item, 'owner-link', $item['url'])),
|
||||
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
|
||||
'olinktitle' => L10n::t('View %s\'s profile @ %s', htmlentities($this->getOwnerName()), $item['owner-link']),
|
||||
'to' => L10n::t('to'),
|
||||
'via' => L10n::t('via'),
|
||||
'wall' => L10n::t('Wall-to-Wall'),
|
||||
|
|
|
@ -952,10 +952,10 @@ class DFRN
|
|||
if (isset($parent_item)) {
|
||||
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
|
||||
if (DBM::is_result($conversation)) {
|
||||
if ($r['conversation-uri'] != '') {
|
||||
if ($conversation['conversation-uri'] != '') {
|
||||
$conversation_uri = $conversation['conversation-uri'];
|
||||
}
|
||||
if ($r['conversation-href'] != '') {
|
||||
if ($conversation['conversation-href'] != '') {
|
||||
$conversation_href = $conversation['conversation-href'];
|
||||
}
|
||||
}
|
||||
|
@ -1534,8 +1534,8 @@ class DFRN
|
|||
private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "")
|
||||
{
|
||||
$author = [];
|
||||
$author["name"] = $xpath->evaluate($element."/atom:name/text()", $context)->item(0)->nodeValue;
|
||||
$author["link"] = $xpath->evaluate($element."/atom:uri/text()", $context)->item(0)->nodeValue;
|
||||
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
|
||||
$author["link"] = XML::getFirstNodeValue($xpath, $element."/atom:uri/text()", $context);
|
||||
|
||||
$fields = ['id', 'uid', 'url', 'network', 'avatar-date', 'avatar', 'name-date', 'uri-date', 'addr',
|
||||
'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
|
||||
|
@ -1606,33 +1606,33 @@ class DFRN
|
|||
}
|
||||
|
||||
// Update contact data
|
||||
$value = $xpath->evaluate($element . "/dfrn:handle/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/dfrn:handle/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["addr"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate($element . "/poco:displayName/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:displayName/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["name"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate($element . "/poco:preferredUsername/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:preferredUsername/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["nick"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate($element . "/poco:note/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:note/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["about"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate($element . "/poco:address/poco:formatted/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:address/poco:formatted/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["location"] = $value;
|
||||
}
|
||||
|
||||
/// @todo Only search for elements with "poco:type" = "xmpp"
|
||||
$value = $xpath->evaluate($element . "/poco:ims/poco:value/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:ims/poco:value/text()", $context);
|
||||
if ($value != "") {
|
||||
$poco["xmpp"] = $value;
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ class DFRN
|
|||
/// - poco:country
|
||||
|
||||
// If the "hide" element is present then the profile isn't searchable.
|
||||
$hide = intval($xpath->evaluate($element . "/dfrn:hide/text()", $context)->item(0)->nodeValue == "true");
|
||||
$hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true");
|
||||
|
||||
logger("Hidden status for contact " . $contact_old["url"] . ": " . $hide, LOGGER_DEBUG);
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ class DFRN
|
|||
}
|
||||
|
||||
// "dfrn:birthday" contains the birthday converted to UTC
|
||||
$birthday = $xpath->evaluate($element . "/dfrn:birthday/text()", $context)->item(0)->nodeValue;
|
||||
$birthday = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
|
||||
|
||||
if (strtotime($birthday) > time()) {
|
||||
$bd_timestamp = strtotime($birthday);
|
||||
|
@ -1676,7 +1676,7 @@ class DFRN
|
|||
}
|
||||
|
||||
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
||||
$value = $xpath->evaluate($element . "/poco:birthday/text()", $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
|
||||
|
||||
if (!in_array($value, ["", "0000-00-00", "0001-01-01"])) {
|
||||
$bdyear = date("Y");
|
||||
|
@ -2410,9 +2410,9 @@ class DFRN
|
|||
$item["source"] = $xml;
|
||||
|
||||
// Get the uri
|
||||
$item["uri"] = $xpath->query("atom:id/text()", $entry)->item(0)->nodeValue;
|
||||
$item["uri"] = XML::getFirstNodeValue($xpath, "atom:id/text()", $entry);
|
||||
|
||||
$item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
|
||||
$item["edited"] = XML::getFirstNodeValue($xpath, "atom:updated/text()", $entry);
|
||||
|
||||
$current = Item::selectFirst(['id', 'uid', 'edited', 'body'],
|
||||
['uri' => $item["uri"], 'uid' => $importer["importer_uid"]]
|
||||
|
@ -2435,11 +2435,11 @@ class DFRN
|
|||
$item["author-link"] = $author["link"];
|
||||
$item["author-id"] = Contact::getIdForURL($author["link"], 0);
|
||||
|
||||
$item["title"] = $xpath->query("atom:title/text()", $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, "atom:title/text()", $entry);
|
||||
|
||||
$item["created"] = $xpath->query("atom:published/text()", $entry)->item(0)->nodeValue;
|
||||
$item["created"] = XML::getFirstNodeValue($xpath, "atom:published/text()", $entry);
|
||||
|
||||
$item["body"] = $xpath->query("dfrn:env/text()", $entry)->item(0)->nodeValue;
|
||||
$item["body"] = XML::getFirstNodeValue($xpath, "dfrn:env/text()", $entry);
|
||||
$item["body"] = str_replace([' ',"\t","\r","\n"], ['','','',''], $item["body"]);
|
||||
// make sure nobody is trying to sneak some html tags by us
|
||||
$item["body"] = notags(base64url_decode($item["body"]));
|
||||
|
@ -2472,18 +2472,15 @@ class DFRN
|
|||
// We don't need the content element since "dfrn:env" is always present
|
||||
//$item["body"] = $xpath->query("atom:content/text()", $entry)->item(0)->nodeValue;
|
||||
|
||||
$item["location"] = $xpath->query("dfrn:location/text()", $entry)->item(0)->nodeValue;
|
||||
$item["location"] = XML::getFirstNodeValue($xpath, "dfrn:location/text()", $entry);
|
||||
|
||||
$georsspoint = $xpath->query("georss:point", $entry);
|
||||
if ($georsspoint) {
|
||||
$item["coord"] = $georsspoint->item(0)->nodeValue;
|
||||
}
|
||||
$item["coord"] = XML::getFirstNodeValue($xpath, "georss:point", $entry);
|
||||
|
||||
$item["private"] = $xpath->query("dfrn:private/text()", $entry)->item(0)->nodeValue;
|
||||
$item["private"] = XML::getFirstNodeValue($xpath, "dfrn:private/text()", $entry);
|
||||
|
||||
$item["extid"] = $xpath->query("dfrn:extid/text()", $entry)->item(0)->nodeValue;
|
||||
$item["extid"] = XML::getFirstNodeValue($xpath, "dfrn:extid/text()", $entry);
|
||||
|
||||
if ($xpath->query("dfrn:bookmark/text()", $entry)->item(0)->nodeValue == "true") {
|
||||
if (XML::getFirstNodeValue($xpath, "dfrn:bookmark/text()", $entry) == "true") {
|
||||
$item["bookmark"] = true;
|
||||
}
|
||||
|
||||
|
@ -2496,18 +2493,18 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$item["guid"] = $xpath->query("dfrn:diaspora_guid/text()", $entry)->item(0)->nodeValue;
|
||||
$item["guid"] = XML::getFirstNodeValue($xpath, "dfrn:diaspora_guid/text()", $entry);
|
||||
|
||||
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "Item::insert"
|
||||
$dsprsig = unxmlify($xpath->query("dfrn:diaspora_signature/text()", $entry)->item(0)->nodeValue);
|
||||
$dsprsig = unxmlify(XML::getFirstNodeValue($xpath, "dfrn:diaspora_signature/text()", $entry));
|
||||
if ($dsprsig != "") {
|
||||
$item["dsprsig"] = $dsprsig;
|
||||
}
|
||||
|
||||
$item["verb"] = $xpath->query("activity:verb/text()", $entry)->item(0)->nodeValue;
|
||||
$item["verb"] = XML::getFirstNodeValue($xpath, "activity:verb/text()", $entry);
|
||||
|
||||
if ($xpath->query("activity:object-type/text()", $entry)->item(0)->nodeValue != "") {
|
||||
$item["object-type"] = $xpath->query("activity:object-type/text()", $entry)->item(0)->nodeValue;
|
||||
if (XML::getFirstNodeValue($xpath, "activity:object-type/text()", $entry) != "") {
|
||||
$item["object-type"] = XML::getFirstNodeValue($xpath, "activity:object-type/text()", $entry);
|
||||
}
|
||||
|
||||
$object = $xpath->query("activity:object", $entry)->item(0);
|
||||
|
@ -2544,8 +2541,10 @@ class DFRN
|
|||
$termhash = array_shift($parts);
|
||||
$termurl = implode(":", $parts);
|
||||
|
||||
if (strlen($item["tag"])) {
|
||||
if (!empty($item["tag"])) {
|
||||
$item["tag"] .= ",";
|
||||
} else {
|
||||
$item["tag"] = "";
|
||||
}
|
||||
|
||||
$item["tag"] .= $termhash . "[url=" . $termurl . "]" . $term . "[/url]";
|
||||
|
@ -2561,7 +2560,7 @@ class DFRN
|
|||
self::parseLinks($links, $item);
|
||||
}
|
||||
|
||||
$item['conversation-uri'] = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;
|
||||
$item['conversation-uri'] = XML::getFirstNodeValue($xpath, 'ostatus:conversation/text()', $entry);
|
||||
|
||||
$conv = $xpath->query('ostatus:conversation', $entry);
|
||||
if (is_object($conv->item(0))) {
|
||||
|
@ -2747,7 +2746,7 @@ class DFRN
|
|||
}
|
||||
|
||||
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
|
||||
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file'], $condition);
|
||||
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
|
||||
if (!DBM::is_result($item)) {
|
||||
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -2835,11 +2834,11 @@ class DFRN
|
|||
logger("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
|
||||
// is it a public forum? Private forums aren't exposed with this method
|
||||
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue);
|
||||
$forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()"));
|
||||
|
||||
// The account type is new since 3.5.1
|
||||
if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
|
||||
$accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()")->item(0)->nodeValue);
|
||||
$accounttype = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:account_type/text()"));
|
||||
|
||||
if ($accounttype != $importer["contact-type"]) {
|
||||
dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
|
||||
|
@ -2887,7 +2886,7 @@ class DFRN
|
|||
$newentries = [];
|
||||
$entries = $xpath->query("/atom:feed/atom:entry");
|
||||
foreach ($entries as $entry) {
|
||||
$created = $xpath->query("atom:published/text()", $entry)->item(0)->nodeValue;
|
||||
$created = XML::getFirstNodeValue($xpath, "atom:published/text()", $entry);
|
||||
$newentries[strtotime($created)] = $entry;
|
||||
}
|
||||
|
||||
|
|
|
@ -1349,7 +1349,7 @@ class Diaspora
|
|||
$author = "";
|
||||
|
||||
// Fetch the author - for the old and the new Diaspora version
|
||||
if ($source_xml->post->status_message->diaspora_handle) {
|
||||
if ($source_xml->post->status_message && $source_xml->post->status_message->diaspora_handle) {
|
||||
$author = (string)$source_xml->post->status_message->diaspora_handle;
|
||||
} elseif ($source_xml->author && ($source_xml->getName() == "status_message")) {
|
||||
$author = (string)$source_xml->author;
|
||||
|
@ -2165,7 +2165,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
// Send all existing comments and likes to the requesting server
|
||||
$comments = Item::select(['id', 'verb', 'self'], ['parent' => $item['id']]);
|
||||
$comments = Item::select(['id', 'parent', 'verb', 'self'], ['parent' => $item['id']]);
|
||||
while ($comment = Item::fetch($comments)) {
|
||||
if ($comment['id'] == $comment['parent']) {
|
||||
continue;
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
use dba;
|
||||
use DOMDocument;
|
||||
|
@ -131,11 +132,11 @@ class Feed {
|
|||
if ($value != "") {
|
||||
$author["author-nick"] = $value;
|
||||
}
|
||||
$value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()')->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:address/poco:formatted/text()');
|
||||
if ($value != "") {
|
||||
$author["author-location"] = $value;
|
||||
}
|
||||
$value = $xpath->evaluate('atom:author/poco:note/text()')->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:note/text()');
|
||||
if ($value != "") {
|
||||
$author["author-about"] = $value;
|
||||
}
|
||||
|
@ -149,9 +150,9 @@ class Feed {
|
|||
}
|
||||
}
|
||||
|
||||
$author["edited"] = $author["created"] = $xpath->query('/atom:feed/atom:updated/text()')->item(0)->nodeValue;
|
||||
$author["edited"] = $author["created"] = XML::getFirstNodeValue($xpath, '/atom:feed/atom:updated/text()');
|
||||
|
||||
$author["app"] = $xpath->evaluate('/atom:feed/atom:generator/text()')->item(0)->nodeValue;
|
||||
$author["app"] = XML::getFirstNodeValue($xpath, '/atom:feed/atom:generator/text()');
|
||||
|
||||
$entries = $xpath->query('/atom:feed/atom:entry');
|
||||
}
|
||||
|
@ -226,16 +227,16 @@ class Feed {
|
|||
}
|
||||
}
|
||||
if ($item["plink"] == "") {
|
||||
$item["plink"] = $xpath->evaluate('link/text()', $entry)->item(0)->nodeValue;
|
||||
$item["plink"] = XML::getFirstNodeValue($xpath, 'link/text()', $entry);
|
||||
}
|
||||
if ($item["plink"] == "") {
|
||||
$item["plink"] = $xpath->evaluate('rss:link/text()', $entry)->item(0)->nodeValue;
|
||||
$item["plink"] = XML::getFirstNodeValue($xpath, 'rss:link/text()', $entry);
|
||||
}
|
||||
|
||||
$item["uri"] = $xpath->evaluate('atom:id/text()', $entry)->item(0)->nodeValue;
|
||||
$item["uri"] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
|
||||
|
||||
if ($item["uri"] == "") {
|
||||
$item["uri"] = $xpath->evaluate('guid/text()', $entry)->item(0)->nodeValue;
|
||||
$item["uri"] = XML::getFirstNodeValue($xpath, 'guid/text()', $entry);
|
||||
}
|
||||
if ($item["uri"] == "") {
|
||||
$item["uri"] = $item["plink"];
|
||||
|
@ -257,23 +258,23 @@ class Feed {
|
|||
}
|
||||
}
|
||||
|
||||
$item["title"] = $xpath->evaluate('atom:title/text()', $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
|
||||
|
||||
if ($item["title"] == "") {
|
||||
$item["title"] = $xpath->evaluate('title/text()', $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'title/text()', $entry);
|
||||
}
|
||||
if ($item["title"] == "") {
|
||||
$item["title"] = $xpath->evaluate('rss:title/text()', $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'rss:title/text()', $entry);
|
||||
}
|
||||
$published = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
|
||||
$published = XML::getFirstNodeValue($xpath, 'atom:published/text()', $entry);
|
||||
|
||||
if ($published == "") {
|
||||
$published = $xpath->query('pubDate/text()', $entry)->item(0)->nodeValue;
|
||||
$published = XML::getFirstNodeValue($xpath, 'pubDate/text()', $entry);
|
||||
}
|
||||
if ($published == "") {
|
||||
$published = $xpath->query('dc:date/text()', $entry)->item(0)->nodeValue;
|
||||
$published = XML::getFirstNodeValue($xpath, 'dc:date/text()', $entry);
|
||||
}
|
||||
$updated = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
|
||||
$updated = XML::getFirstNodeValue($xpath, 'atom:updated/text()', $entry);
|
||||
|
||||
if ($updated == "") {
|
||||
$updated = $published;
|
||||
|
@ -284,18 +285,18 @@ class Feed {
|
|||
if ($updated != "") {
|
||||
$item["edited"] = $updated;
|
||||
}
|
||||
$creator = $xpath->query('author/text()', $entry)->item(0)->nodeValue;
|
||||
$creator = XML::getFirstNodeValue($xpath, 'author/text()', $entry);
|
||||
|
||||
if ($creator == "") {
|
||||
$creator = $xpath->query('atom:author/atom:name/text()', $entry)->item(0)->nodeValue;
|
||||
$creator = XML::getFirstNodeValue($xpath, 'atom:author/atom:name/text()', $entry);
|
||||
}
|
||||
if ($creator == "") {
|
||||
$creator = $xpath->query('dc:creator/text()', $entry)->item(0)->nodeValue;
|
||||
$creator = XML::getFirstNodeValue($xpath, 'dc:creator/text()', $entry);
|
||||
}
|
||||
if ($creator != "") {
|
||||
$item["author-name"] = $creator;
|
||||
}
|
||||
$creator = $xpath->query('dc:creator/text()', $entry)->item(0)->nodeValue;
|
||||
$creator = XML::getFirstNodeValue($xpath, 'dc:creator/text()', $entry);
|
||||
|
||||
if ($creator != "") {
|
||||
$item["author-name"] = $creator;
|
||||
|
|
|
@ -55,9 +55,9 @@ class OStatus
|
|||
private static function fetchAuthor($xpath, $context, $importer, &$contact, $onlyfetch)
|
||||
{
|
||||
$author = [];
|
||||
$author["author-link"] = $xpath->evaluate('atom:author/atom:uri/text()', $context)->item(0)->nodeValue;
|
||||
$author["author-name"] = $xpath->evaluate('atom:author/atom:name/text()', $context)->item(0)->nodeValue;
|
||||
$addr = $xpath->evaluate('atom:author/atom:email/text()', $context)->item(0)->nodeValue;
|
||||
$author["author-link"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context);
|
||||
$author["author-name"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:name/text()', $context);
|
||||
$addr = XML::getFirstNodeValue($xpath, 'atom:author/atom:email/text()', $context);
|
||||
|
||||
$aliaslink = $author["author-link"];
|
||||
|
||||
|
@ -126,7 +126,7 @@ class OStatus
|
|||
$author["author-avatar"] = Probe::fixAvatar(current($avatarlist), $author["author-link"]);
|
||||
}
|
||||
|
||||
$displayname = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
|
||||
$displayname = XML::getFirstNodeValue($xpath, 'atom:author/poco:displayName/text()', $context);
|
||||
if ($displayname != "") {
|
||||
$author["author-name"] = $displayname;
|
||||
}
|
||||
|
@ -155,27 +155,27 @@ class OStatus
|
|||
$contact['url'] = $author["author-link"];
|
||||
$contact['nurl'] = normalise_link($contact['url']);
|
||||
|
||||
$value = $xpath->evaluate('atom:author/atom:uri/text()', $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context);
|
||||
if ($value != "") {
|
||||
$contact["alias"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:displayName/text()', $context);
|
||||
if ($value != "") {
|
||||
$contact["name"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:preferredUsername/text()', $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:preferredUsername/text()', $context);
|
||||
if ($value != "") {
|
||||
$contact["nick"] = $value;
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:note/text()', $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:note/text()', $context);
|
||||
if ($value != "") {
|
||||
$contact["about"] = HTML::toBBCode($value);
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()', $context)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:address/poco:formatted/text()', $context);
|
||||
if ($value != "") {
|
||||
$contact["location"] = $value;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ class OStatus
|
|||
$author = self::fetchAuthor($xpath, $entry, $importer, $contact, $stored);
|
||||
}
|
||||
|
||||
$value = $xpath->evaluate('atom:author/poco:preferredUsername/text()', $entry)->item(0)->nodeValue;
|
||||
$value = XML::getFirstNodeValue($xpath, 'atom:author/poco:preferredUsername/text()', $context);
|
||||
if ($value != "") {
|
||||
$nickname = $value;
|
||||
} else {
|
||||
|
@ -399,9 +399,9 @@ class OStatus
|
|||
|
||||
$item = array_merge($header, $author);
|
||||
|
||||
$item["uri"] = $xpath->query('atom:id/text()', $entry)->item(0)->nodeValue;
|
||||
$item["uri"] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
|
||||
|
||||
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
|
||||
$item["verb"] = XML::getFirstNodeValue($xpath, 'activity:verb/text()', $entry);
|
||||
|
||||
// Delete a message
|
||||
if (in_array($item["verb"], ['qvitter-delete-notice', ACTIVITY_DELETE, 'delete'])) {
|
||||
|
@ -561,19 +561,18 @@ class OStatus
|
|||
*/
|
||||
private static function processPost($xpath, $entry, &$item, $importer)
|
||||
{
|
||||
$item["body"] = HTML::toBBCode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
|
||||
$item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
|
||||
$item["body"] = HTML::toBBCode(XML::getFirstNodeValue($xpath, 'atom:content/text()', $entry));
|
||||
$item["object-type"] = XML::getFirstNodeValue($xpath, 'activity:object-type/text()', $entry);
|
||||
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
||||
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
|
||||
$item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
|
||||
$item["body"] = XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry);
|
||||
} elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) {
|
||||
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
|
||||
}
|
||||
|
||||
$item["created"] = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
|
||||
$item["edited"] = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
|
||||
$conversation = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;
|
||||
$item['conversation-uri'] = $conversation;
|
||||
$item["created"] = XML::getFirstNodeValue($xpath, 'atom:published/text()', $entry);
|
||||
$item["edited"] = XML::getFirstNodeValue($xpath, 'atom:updated/text()', $entry);
|
||||
$item['conversation-uri'] = XML::getFirstNodeValue($xpath, 'ostatus:conversation/text()', $entry);
|
||||
|
||||
$conv = $xpath->query('ostatus:conversation', $entry);
|
||||
if (is_object($conv->item(0))) {
|
||||
|
@ -661,7 +660,7 @@ class OStatus
|
|||
|
||||
// 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;
|
||||
$clear_text = XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry);
|
||||
if (!empty($clear_text)) {
|
||||
$item['content-warning'] = HTML::toBBCode($clear_text);
|
||||
}
|
||||
|
@ -787,7 +786,7 @@ class OStatus
|
|||
|
||||
$conv_data['protocol'] = PROTOCOL_SPLITTED_CONV;
|
||||
$conv_data['network'] = NETWORK_OSTATUS;
|
||||
$conv_data['uri'] = $xpath->query('atom:id/text()', $entry)->item(0)->nodeValue;
|
||||
$conv_data['uri'] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
|
||||
|
||||
$inreplyto = $xpath->query('thr:in-reply-to', $entry);
|
||||
if (is_object($inreplyto->item(0))) {
|
||||
|
@ -798,8 +797,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
|
||||
$conv = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;
|
||||
$conv_data['conversation-uri'] = $conv;
|
||||
$conv_data['conversation-uri'] = XML::getFirstNodeValue($xpath, 'ostatus:conversation/text()', $entry);
|
||||
|
||||
$conv = $xpath->query('ostatus:conversation', $entry);
|
||||
if (is_object($conv->item(0))) {
|
||||
|
@ -1003,7 +1001,7 @@ class OStatus
|
|||
|
||||
$link_data = [];
|
||||
|
||||
$orig_uri = $xpath->query('atom:id/text()', $activityobjects)->item(0)->nodeValue;
|
||||
$orig_uri = XML::getFirstNodeValue($xpath, 'atom:id/text()', $activityobjects);
|
||||
|
||||
$links = $xpath->query("atom:link", $activityobjects);
|
||||
if ($links) {
|
||||
|
@ -1173,12 +1171,12 @@ class OStatus
|
|||
|
||||
$guid = "";
|
||||
preg_match("/guid='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "") {
|
||||
if (!empty($matches[1])) {
|
||||
$guid = $matches[1];
|
||||
}
|
||||
|
||||
preg_match('/guid="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "") {
|
||||
if (!empty($matches[1])) {
|
||||
$guid = $matches[1];
|
||||
}
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ class Network
|
|||
public static function stripTrackingQueryParams($url)
|
||||
{
|
||||
$urldata = parse_url($url);
|
||||
if (is_string($urldata["query"])) {
|
||||
if (!empty($urldata["query"])) {
|
||||
$query = $urldata["query"];
|
||||
parse_str($query, $querydata);
|
||||
|
||||
|
@ -838,14 +838,35 @@ class Network
|
|||
return "";
|
||||
}
|
||||
|
||||
if (empty($parts1["scheme"])) {
|
||||
$parts1["scheme"] = '';
|
||||
}
|
||||
if (empty($parts2["scheme"])) {
|
||||
$parts2["scheme"] = '';
|
||||
}
|
||||
|
||||
if ($parts1["scheme"] != $parts2["scheme"]) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (empty($parts1["host"])) {
|
||||
$parts1["host"] = '';
|
||||
}
|
||||
if (empty($parts2["host"])) {
|
||||
$parts2["host"] = '';
|
||||
}
|
||||
|
||||
if ($parts1["host"] != $parts2["host"]) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (empty($parts1["port"])) {
|
||||
$parts1["port"] = '';
|
||||
}
|
||||
if (empty($parts2["port"])) {
|
||||
$parts2["port"] = '';
|
||||
}
|
||||
|
||||
if ($parts1["port"] != $parts2["port"]) {
|
||||
return "";
|
||||
}
|
||||
|
@ -856,6 +877,13 @@ class Network
|
|||
$match .= ":".$parts1["port"];
|
||||
}
|
||||
|
||||
if (empty($parts1["path"])) {
|
||||
$parts1["path"] = '';
|
||||
}
|
||||
if (empty($parts2["path"])) {
|
||||
$parts2["path"] = '';
|
||||
}
|
||||
|
||||
$pathparts1 = explode("/", $parts1["path"]);
|
||||
$pathparts2 = explode("/", $parts2["path"]);
|
||||
|
||||
|
|
|
@ -431,4 +431,19 @@ class XML
|
|||
}
|
||||
return $x;
|
||||
}
|
||||
|
||||
public static function getFirstNodeValue($xpath, $element, $context = null)
|
||||
{
|
||||
$result = $xpath->evaluate($element, $context);
|
||||
if (!is_object($result)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$first_item = $result->item(0);
|
||||
if (!is_object($first_item)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $first_item->nodeValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class Delivery extends BaseObject
|
|||
|
||||
$condition = ['id' => [$item_id, $parent_id], 'visible' => true, 'moderated' => false];
|
||||
$params = ['order' => ['id']];
|
||||
$itemdata = Item::select([], $condition, $params);
|
||||
$itemdata = Item::select(Item::ITEM_FIELDLIST, $condition, $params);
|
||||
|
||||
$items = [];
|
||||
while ($item = Item::fetch($itemdata)) {
|
||||
|
@ -259,6 +259,10 @@ class Delivery extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$user = dba::selectFirst('user', [], ['uid' => $target_uid]);
|
||||
|
||||
$target_importer = array_merge($target_importer, $user);
|
||||
|
||||
// Set the user id. This is important if this is a public contact
|
||||
$target_importer['importer_uid'] = $target_uid;
|
||||
DFRN::import($atom, $target_importer);
|
||||
|
|
|
@ -29,11 +29,13 @@ function vier_init(App $a)
|
|||
|
||||
$a->set_template_engine('smarty3');
|
||||
|
||||
if (!empty($a->argv[0]) && !empty($a->argv[1])) {
|
||||
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) {
|
||||
vier_community_info();
|
||||
|
||||
$a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($a->is_mobile || $a->is_tablet) {
|
||||
$a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n";
|
||||
|
@ -104,7 +106,7 @@ EOT;
|
|||
|
||||
// Hide the left menu bar
|
||||
/// @TODO maybe move this static array out where it should belong?
|
||||
if (($a->page['aside'] == "") && in_array($a->argv[0], ["community", "events", "help", "manage", "notifications",
|
||||
if (empty($a->page['aside']) && in_array($a->argv[0], ["community", "events", "help", "manage", "notifications",
|
||||
"probe", "webfinger", "login", "invite", "credits"])) {
|
||||
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue