Merge remote-tracking branch 'upstream/develop' into app-user2
This commit is contained in:
commit
4495e83eca
11
database.sql
11
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2021.09-dev (Siberian Iris)
|
||||
-- DB_UPDATE_VERSION 1431
|
||||
-- DB_UPDATE_VERSION 1432
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -126,7 +126,8 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
`about` text COMMENT '',
|
||||
`keywords` text COMMENT 'public keywords (interests) of the contact',
|
||||
`gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
|
||||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
|
||||
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
|
||||
`attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
|
||||
|
@ -1366,7 +1367,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
|
|||
`education` text COMMENT 'Deprecated',
|
||||
`contact` text COMMENT 'Deprecated',
|
||||
`homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
|
||||
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
|
||||
`photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
|
||||
|
@ -2199,6 +2201,7 @@ CREATE VIEW `owner-view` AS SELECT
|
|||
`contact`.`keywords` AS `keywords`,
|
||||
`contact`.`gender` AS `gender`,
|
||||
`contact`.`xmpp` AS `xmpp`,
|
||||
`contact`.`matrix` AS `matrix`,
|
||||
`contact`.`attag` AS `attag`,
|
||||
`contact`.`avatar` AS `avatar`,
|
||||
`contact`.`photo` AS `photo`,
|
||||
|
@ -2325,6 +2328,7 @@ CREATE VIEW `account-view` AS SELECT
|
|||
`contact`.`about` AS `about`,
|
||||
`contact`.`keywords` AS `keywords`,
|
||||
`contact`.`xmpp` AS `xmpp`,
|
||||
`contact`.`matrix` AS `matrix`,
|
||||
`contact`.`avatar` AS `avatar`,
|
||||
`contact`.`photo` AS `photo`,
|
||||
`contact`.`thumb` AS `thumb`,
|
||||
|
@ -2408,6 +2412,7 @@ CREATE VIEW `account-user-view` AS SELECT
|
|||
`contact`.`about` AS `about`,
|
||||
`contact`.`keywords` AS `keywords`,
|
||||
`contact`.`xmpp` AS `xmpp`,
|
||||
`contact`.`matrix` AS `matrix`,
|
||||
`contact`.`avatar` AS `avatar`,
|
||||
`contact`.`photo` AS `photo`,
|
||||
`contact`.`thumb` AS `thumb`,
|
||||
|
|
|
@ -24,7 +24,8 @@ Fields
|
|||
| about | | text | YES | | NULL | |
|
||||
| keywords | public keywords (interests) of the contact | text | YES | | NULL | |
|
||||
| gender | Deprecated | varchar(32) | NO | | | |
|
||||
| xmpp | | varchar(255) | NO | | | |
|
||||
| xmpp | XMPP address | varchar(255) | NO | | | |
|
||||
| matrix | Matrix address | varchar(255) | NO | | | |
|
||||
| attag | | varchar(255) | NO | | | |
|
||||
| avatar | | varchar(255) | NO | | | |
|
||||
| photo | Link to the profile photo of the contact | varchar(255) | YES | | | |
|
||||
|
|
|
@ -45,7 +45,8 @@ Fields
|
|||
| education | Deprecated | text | YES | | NULL | |
|
||||
| contact | Deprecated | text | YES | | NULL | |
|
||||
| homepage | | varchar(255) | NO | | | |
|
||||
| xmpp | | varchar(255) | NO | | | |
|
||||
| xmpp | XMPP address | varchar(255) | NO | | | |
|
||||
| matrix | Matrix address | varchar(255) | NO | | | |
|
||||
| photo | | varchar(255) | NO | | | |
|
||||
| thumb | | varchar(255) | NO | | | |
|
||||
| publish | publish default profile in local directory | boolean | NO | | 0 | |
|
||||
|
|
14
mod/item.php
14
mod/item.php
|
@ -680,7 +680,11 @@ function item_post(App $a) {
|
|||
$o = conversation($a, [array_merge($contact_record, $datarray)], 'search', false, true);
|
||||
|
||||
System::jsonExit(['preview' => $o]);
|
||||
} elseif (!empty($_REQUEST['scheduled_at'])) {
|
||||
}
|
||||
|
||||
Hook::callAll('post_local',$datarray);
|
||||
|
||||
if (!empty($_REQUEST['scheduled_at'])) {
|
||||
$scheduled_at = DateTimeFormat::convert($_REQUEST['scheduled_at'], 'UTC', $a->getTimezone());
|
||||
if ($scheduled_at > DateTimeFormat::utcNow()) {
|
||||
unset($datarray['created']);
|
||||
|
@ -692,15 +696,11 @@ function item_post(App $a) {
|
|||
unset($datarray['self']);
|
||||
unset($datarray['api_source']);
|
||||
|
||||
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, false, $scheduled_at);
|
||||
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||
}
|
||||
}
|
||||
|
||||
$datarray['uri-id'] = ItemURI::getIdByURI($datarray['uri']);
|
||||
|
||||
Hook::callAll('post_local',$datarray);
|
||||
|
||||
if (!empty($datarray['cancel'])) {
|
||||
Logger::info('mod_item: post cancelled by addon.');
|
||||
if ($return_path) {
|
||||
|
@ -715,6 +715,8 @@ function item_post(App $a) {
|
|||
System::jsonExit($json);
|
||||
}
|
||||
|
||||
$datarray['uri-id'] = ItemURI::getIdByURI($datarray['uri']);
|
||||
|
||||
if ($orig_post) {
|
||||
// Fill the cache field
|
||||
// This could be done in Item::update as well - but we have to check for the existance of some fields.
|
||||
|
|
|
@ -94,6 +94,7 @@ class VCard
|
|||
'$url' => Contact::magicLinkByContact($contact, $contact['url']),
|
||||
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''),
|
||||
'$xmpp' => DI::l10n()->t('XMPP:'),
|
||||
'$matrix' => DI::l10n()->t('Matrix:'),
|
||||
'$location' => DI::l10n()->t('Location:'),
|
||||
'$network_link' => $network_link,
|
||||
'$network_avatar' => $network_avatar,
|
||||
|
|
|
@ -676,7 +676,7 @@ class Contact
|
|||
public static function updateSelfFromUserID($uid, $update_avatar = false)
|
||||
{
|
||||
$fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'avatar', 'prvkey', 'pubkey',
|
||||
'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable',
|
||||
'xmpp', 'matrix', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable',
|
||||
'photo', 'thumb', 'micro', 'addr', 'request', 'notify', 'poll', 'confirm', 'poco', 'network'];
|
||||
$self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
|
||||
if (!DBA::isResult($self)) {
|
||||
|
@ -690,7 +690,7 @@ class Contact
|
|||
}
|
||||
|
||||
$fields = ['name', 'photo', 'thumb', 'about', 'address', 'locality', 'region',
|
||||
'country-name', 'pub_keywords', 'xmpp', 'net-publish'];
|
||||
'country-name', 'pub_keywords', 'xmpp', 'matrix', 'net-publish'];
|
||||
$profile = DBA::selectFirst('profile', $fields, ['uid' => $uid]);
|
||||
if (!DBA::isResult($profile)) {
|
||||
return false;
|
||||
|
@ -702,7 +702,7 @@ class Contact
|
|||
'avatar-date' => $self['avatar-date'], 'location' => Profile::formatLocation($profile),
|
||||
'about' => $profile['about'], 'keywords' => $profile['pub_keywords'],
|
||||
'contact-type' => $user['account-type'], 'prvkey' => $user['prvkey'],
|
||||
'pubkey' => $user['pubkey'], 'xmpp' => $profile['xmpp'], 'network' => Protocol::DFRN];
|
||||
'pubkey' => $user['pubkey'], 'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'], 'network' => Protocol::DFRN];
|
||||
|
||||
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
|
||||
$fields['url'] = DI::baseUrl() . '/profile/' . $user['nickname'];
|
||||
|
@ -2064,11 +2064,11 @@ class Contact
|
|||
*/
|
||||
|
||||
// These fields aren't updated by this routine:
|
||||
// 'xmpp', 'sensitive'
|
||||
// 'sensitive'
|
||||
|
||||
$fields = ['uid', 'uri-id', 'avatar', 'header', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
|
||||
'manually-approve', 'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
|
||||
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item'];
|
||||
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item', 'xmpp', 'matrix'];
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return false;
|
||||
|
|
|
@ -706,7 +706,7 @@ class Item
|
|||
return GRAVITY_UNKNOWN; // Should not happen
|
||||
}
|
||||
|
||||
public static function insert($item, $notify = false, $dontcache = false)
|
||||
public static function insert(array $item, bool $notify = false, bool $post_local = true)
|
||||
{
|
||||
$orig_item = $item;
|
||||
|
||||
|
@ -931,7 +931,7 @@ class Item
|
|||
$item["private"] = self::PRIVATE;
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
if ($notify && $post_local) {
|
||||
$item['edit'] = false;
|
||||
$item['parent'] = $parent_id;
|
||||
|
||||
|
@ -953,7 +953,7 @@ class Item
|
|||
unset($_SESSION['authenticated']);
|
||||
unset($_SESSION['uid']);
|
||||
}
|
||||
} else {
|
||||
} elseif (!$notify) {
|
||||
Hook::callAll('post_remote', $item);
|
||||
}
|
||||
|
||||
|
@ -1141,7 +1141,6 @@ class Item
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!$dontcache) {
|
||||
if ($notify) {
|
||||
if (!\Friendica\Content\Feature::isEnabled($posted_item['uid'], 'explicit_mentions') && ($posted_item['gravity'] == GRAVITY_COMMENT)) {
|
||||
Tag::createImplicitMentions($posted_item['uri-id'], $posted_item['thr-parent-id']);
|
||||
|
@ -1150,7 +1149,6 @@ class Item
|
|||
} else {
|
||||
Hook::callAll('post_remote_end', $posted_item);
|
||||
}
|
||||
}
|
||||
|
||||
if ($posted_item['gravity'] === GRAVITY_PARENT) {
|
||||
self::addShadow($post_user_id);
|
||||
|
@ -1465,7 +1463,7 @@ class Item
|
|||
}
|
||||
}
|
||||
|
||||
$distributed = self::insert($item, $notify, true);
|
||||
$distributed = self::insert($item, $notify);
|
||||
|
||||
if (!$distributed) {
|
||||
Logger::info("Distributed item wasn't stored", ['uri-id' => $item['uri-id'], 'user' => $uid]);
|
||||
|
@ -1534,7 +1532,7 @@ class Item
|
|||
$item['contact-id'] = $item['author-id'];
|
||||
}
|
||||
|
||||
$public_shadow = self::insert($item, false, true);
|
||||
$public_shadow = self::insert($item);
|
||||
|
||||
Logger::info('Stored public shadow', ['thread' => $itemid, 'id' => $public_shadow]);
|
||||
}
|
||||
|
@ -1593,7 +1591,7 @@ class Item
|
|||
unset($item['post-reason']);
|
||||
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
|
||||
|
||||
$public_shadow = self::insert($item, false, true);
|
||||
$public_shadow = self::insert($item);
|
||||
|
||||
Logger::info('Stored public shadow', ['uri-id' => $item['uri-id'], 'id' => $public_shadow]);
|
||||
|
||||
|
|
|
@ -33,19 +33,36 @@ use Friendica\Util\DateTimeFormat;
|
|||
|
||||
class Delayed
|
||||
{
|
||||
/**
|
||||
* The content of the post is posted as is. Connector settings are using the default settings.
|
||||
* This is used for automated scheduled posts via feeds or from the API.
|
||||
*/
|
||||
const PREPARED = 0;
|
||||
/**
|
||||
* The content is posted like a manual post. Means some processing of body will be done.
|
||||
* Also it is posted with default permissions and default connector settings.
|
||||
* This is used for mirrored connector posts.
|
||||
*/
|
||||
const UNPREPARED = 1;
|
||||
/**
|
||||
* Like PREPARED, but additionally the connector settings can differ.
|
||||
* This is used when manually publishing scheduled posts.
|
||||
*/
|
||||
const PREPARED_NO_HOOK = 2;
|
||||
|
||||
/**
|
||||
* Insert a new delayed post
|
||||
*
|
||||
* @param string $uri
|
||||
* @param array $item
|
||||
* @param integer $notify
|
||||
* @param bool $unprepared
|
||||
* @param int $notify
|
||||
* @param int $preparation_mode
|
||||
* @param string $delayed
|
||||
* @param array $taglist
|
||||
* @param array $attachments
|
||||
* @return int ID of the created delayed post entry
|
||||
*/
|
||||
public static function add(string $uri, array $item, int $notify = 0, bool $unprepared = false, string $delayed = '', array $taglist = [], array $attachments = [])
|
||||
public static function add(string $uri, array $item, int $notify = 0, int $preparation_mode = self::PREPARED, string $delayed = '', array $taglist = [], array $attachments = [])
|
||||
{
|
||||
if (empty($item['uid']) || self::exists($uri, $item['uid'])) {
|
||||
Logger::notice('No uid or already found');
|
||||
|
@ -63,7 +80,7 @@ class Delayed
|
|||
|
||||
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
||||
|
||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $unprepared, $uri);
|
||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
||||
if (!$wid) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -169,20 +186,20 @@ class Delayed
|
|||
* Publish a delayed post
|
||||
*
|
||||
* @param array $item
|
||||
* @param integer $notify
|
||||
* @param int $notify
|
||||
* @param array $taglist
|
||||
* @param array $attachments
|
||||
* @param bool $unprepared
|
||||
* @param int $preparation_mode
|
||||
* @param string $uri
|
||||
* @return bool
|
||||
*/
|
||||
public static function publish(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false, string $uri = '')
|
||||
public static function publish(array $item, int $notify = 0, array $taglist = [], array $attachments = [], int $preparation_mode = self::PREPARED, string $uri = '')
|
||||
{
|
||||
if (!empty($attachments)) {
|
||||
$item['attachments'] = $attachments;
|
||||
}
|
||||
|
||||
if ($unprepared) {
|
||||
if ($preparation_mode == self::UNPREPARED) {
|
||||
$_SESSION['authenticated'] = true;
|
||||
$_SESSION['uid'] = $item['uid'];
|
||||
|
||||
|
@ -209,7 +226,8 @@ class Delayed
|
|||
|
||||
return $id;
|
||||
}
|
||||
$id = Item::insert($item, $notify);
|
||||
|
||||
$id = Item::insert($item, $notify, $preparation_mode == self::PREPARED);
|
||||
|
||||
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
|
||||
|
||||
|
|
|
@ -361,6 +361,7 @@ class Profile
|
|||
$homepage = !empty($profile['homepage']) ? DI::l10n()->t('Homepage:') : false;
|
||||
$about = !empty($profile['about']) ? DI::l10n()->t('About:') : false;
|
||||
$xmpp = !empty($profile['xmpp']) ? DI::l10n()->t('XMPP:') : false;
|
||||
$matrix = !empty($profile['matrix']) ? DI::l10n()->t('Matrix:') : false;
|
||||
|
||||
if ((!empty($profile['hidewall']) || $block) && !Session::isAuthenticated()) {
|
||||
$location = $homepage = $about = false;
|
||||
|
@ -439,6 +440,7 @@ class Profile
|
|||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$profile' => $p,
|
||||
'$xmpp' => $xmpp,
|
||||
'$matrix' => $matrix,
|
||||
'$follow' => DI::l10n()->t('Follow'),
|
||||
'$follow_link' => $follow_link,
|
||||
'$unfollow' => DI::l10n()->t('Unfollow'),
|
||||
|
|
|
@ -186,7 +186,7 @@ class Statuses extends BaseApi
|
|||
if (!empty($request['scheduled_at'])) {
|
||||
$item['guid'] = Item::guid($item, true);
|
||||
$item['uri'] = Item::newURI($item['uid'], $item['guid']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, false, $request['scheduled_at']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||
if (empty($id)) {
|
||||
DI::mstdnError()->InternalError();
|
||||
}
|
||||
|
|
|
@ -607,6 +607,8 @@ class Contact extends BaseModule
|
|||
'$location_label' => DI::l10n()->t('Location:'),
|
||||
'$xmpp' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['xmpp']),
|
||||
'$xmpp_label' => DI::l10n()->t('XMPP:'),
|
||||
'$matrix' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['matrix']),
|
||||
'$matrix_label' => DI::l10n()->t('Matrix:'),
|
||||
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
|
||||
'$about_label' => DI::l10n()->t('About:'),
|
||||
'$keywords' => $contact['keywords'],
|
||||
|
|
|
@ -120,7 +120,7 @@ class NoScrape extends BaseModule
|
|||
$json_info['last-activity'] = date('o-W', $last_active);
|
||||
|
||||
//These are optional fields.
|
||||
$profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name'];
|
||||
$profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name', 'xmpp', 'matrix'];
|
||||
foreach ($profile_fields as $field) {
|
||||
if (!empty($profile[$field])) {
|
||||
$json_info["$field"] = $profile[$field];
|
||||
|
|
|
@ -176,6 +176,10 @@ class Profile extends BaseProfile
|
|||
$basic_fields += self::buildField('xmpp', DI::l10n()->t('XMPP:'), $profile['xmpp']);
|
||||
}
|
||||
|
||||
if ($profile['matrix']) {
|
||||
$basic_fields += self::buildField('matrix', DI::l10n()->t('Matrix:'), $profile['matrix']);
|
||||
}
|
||||
|
||||
if ($profile['homepage']) {
|
||||
$basic_fields += self::buildField('homepage', DI::l10n()->t('Homepage:'), HTML::toLink($profile['homepage']));
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ class Index extends BaseSettings
|
|||
$pub_keywords = self::cleanKeywords(Strings::escapeTags(trim($_POST['pub_keywords'])));
|
||||
$prv_keywords = self::cleanKeywords(Strings::escapeTags(trim($_POST['prv_keywords'])));
|
||||
$xmpp = Strings::escapeTags(trim($_POST['xmpp']));
|
||||
$matrix = Strings::escapeTags(trim($_POST['matrix']));
|
||||
$homepage = Strings::escapeTags(trim($_POST['homepage']));
|
||||
if ((strpos($homepage, 'http') !== 0) && (strlen($homepage))) {
|
||||
// neither http nor https in URL, add them
|
||||
|
@ -120,6 +121,7 @@ class Index extends BaseSettings
|
|||
'postal-code' => $postal_code,
|
||||
'country-name' => $country_name,
|
||||
'xmpp' => $xmpp,
|
||||
'matrix' => $matrix,
|
||||
'homepage' => $homepage,
|
||||
'pub_keywords' => $pub_keywords,
|
||||
'prv_keywords' => $prv_keywords,
|
||||
|
@ -240,6 +242,7 @@ class Index extends BaseSettings
|
|||
'$country_name' => ['country_name', DI::l10n()->t('Country:'), $profile['country-name']],
|
||||
'$age' => ((intval($profile['dob'])) ? '(' . DI::l10n()->t('Age: ') . DI::l10n()->tt('%d year old', '%d years old', Temporal::getAgeByTimezone($profile['dob'], $profile['timezone'])) . ')' : ''),
|
||||
'$xmpp' => ['xmpp', DI::l10n()->t('XMPP (Jabber) address:'), $profile['xmpp'], DI::l10n()->t('The XMPP address will be propagated to your contacts so that they can follow you.')],
|
||||
'$matrix' => ['matrix', DI::l10n()->t('Matrix (Element) address:'), $profile['matrix'], DI::l10n()->t('The Matrix address will be published so that people can follow you there.')],
|
||||
'$homepage' => ['homepage', DI::l10n()->t('Homepage URL:'), $profile['homepage']],
|
||||
'$pub_keywords' => ['pub_keywords', DI::l10n()->t('Public Keywords:'), $profile['pub_keywords'], DI::l10n()->t('(Used for suggesting potential friends, can be seen by others)')],
|
||||
'$prv_keywords' => ['prv_keywords', DI::l10n()->t('Private Keywords:'), $profile['prv_keywords'], DI::l10n()->t('(Used for searching profiles, never shown to others)')],
|
||||
|
|
|
@ -47,7 +47,7 @@ class Xrd extends BaseModule
|
|||
}
|
||||
|
||||
$uri = urldecode(Strings::escapeTags(trim($_GET['uri'])));
|
||||
if (($_SERVER['HTTP_ACCEPT'] ?? '') == 'application/jrd+json') {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT'] ?? '', 'application/jrd+json') !== false) {
|
||||
$mode = 'json';
|
||||
} else {
|
||||
$mode = 'xml';
|
||||
|
@ -58,7 +58,7 @@ class Xrd extends BaseModule
|
|||
}
|
||||
|
||||
$uri = urldecode(Strings::escapeTags(trim($_GET['resource'])));
|
||||
if (($_SERVER['HTTP_ACCEPT'] ?? '') == 'application/xrd+xml') {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT'] ?? '', 'application/xrd+xml') !== false) {
|
||||
$mode = 'xml';
|
||||
} else {
|
||||
$mode = 'json';
|
||||
|
@ -159,9 +159,6 @@ class Xrd extends BaseModule
|
|||
{
|
||||
$salmon_key = Salmon::salmonKey($owner['spubkey']);
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
|
||||
$json = [
|
||||
'subject' => 'acct:' . $owner['addr'],
|
||||
'aliases' => [
|
||||
|
@ -235,8 +232,8 @@ class Xrd extends BaseModule
|
|||
],
|
||||
];
|
||||
|
||||
echo json_encode($json);
|
||||
exit();
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
System::jsonExit($json, 'application/jrd+json; charset=utf-8');
|
||||
}
|
||||
|
||||
private static function printXML($alias, $baseURL, $user, $owner, $avatar)
|
||||
|
|
|
@ -89,8 +89,8 @@ class Probe
|
|||
private static function rearrangeData($data)
|
||||
{
|
||||
$fields = ["name", "nick", "guid", "url", "addr", "alias", "photo", "header",
|
||||
"account-type", "community", "keywords", "location", "about", "hide",
|
||||
"batch", "notify", "poll", "request", "confirm", "subscribe", "poco",
|
||||
"account-type", "community", "keywords", "location", "about", "xmpp", "matrix",
|
||||
"hide", "batch", "notify", "poll", "request", "confirm", "subscribe", "poco",
|
||||
"following", "followers", "inbox", "outbox", "sharedinbox",
|
||||
"priority", "network", "pubkey", "manually-approve", "baseurl", "gsid"];
|
||||
|
||||
|
@ -1067,6 +1067,14 @@ class Probe
|
|||
$data["about"] = $json["about"];
|
||||
}
|
||||
|
||||
if (!empty($json["xmpp"])) {
|
||||
$data["xmpp"] = $json["xmpp"];
|
||||
}
|
||||
|
||||
if (!empty($json["matrix"])) {
|
||||
$data["matrix"] = $json["matrix"];
|
||||
}
|
||||
|
||||
if (!empty($json["key"])) {
|
||||
$data["pubkey"] = $json["key"];
|
||||
}
|
||||
|
@ -2230,6 +2238,7 @@ class Probe
|
|||
'header' => $profile['header'] ? Contact::getHeaderUrlForId($profile['id'], $profile['updated']) : '',
|
||||
'account-type' => $profile['contact-type'], 'community' => ($profile['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY),
|
||||
'keywords' => $profile['keywords'], 'location' => $profile['location'], 'about' => $profile['about'],
|
||||
'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'],
|
||||
'hide' => !$profile['net-publish'], 'batch' => '', 'notify' => $profile['notify'],
|
||||
'poll' => $profile['poll'], 'request' => $profile['request'], 'confirm' => $profile['confirm'],
|
||||
'subscribe' => $approfile['generator']['url'] . '/follow?url={uri}', 'poco' => $profile['poco'],
|
||||
|
|
|
@ -354,7 +354,7 @@ class Transmitter
|
|||
|
||||
$data['url'] = $owner['url'];
|
||||
$data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['discoverable'] = $owner['net-publish'];
|
||||
$data['discoverable'] = (bool)$owner['net-publish'];
|
||||
$data['publicKey'] = ['id' => $owner['url'] . '#main-key',
|
||||
'owner' => $owner['url'],
|
||||
'publicKeyPem' => $owner['pubkey']];
|
||||
|
|
|
@ -601,7 +601,7 @@ class Feed
|
|||
}
|
||||
$publish_at = date(DateTimeFormat::MYSQL, $publish_time);
|
||||
|
||||
if (Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments'])) {
|
||||
if (Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], Post\Delayed::PREPARED, $publish_at, $posting['taglist'], $posting['attachments'])) {
|
||||
DI::pConfig()->set($item['uid'], 'system', 'last_publish', $publish_time);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,16 +30,16 @@ class DelayedPublish
|
|||
* Publish a post, used for delayed postings
|
||||
*
|
||||
* @param array $item
|
||||
* @param integer $notify
|
||||
* @param int $notify
|
||||
* @param array $taglist
|
||||
* @param array $attachments
|
||||
* @param bool $unprepared
|
||||
* @param int $preparation_mode
|
||||
* @param string $uri
|
||||
* @return void
|
||||
*/
|
||||
public static function execute(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false, string $uri = '')
|
||||
public static function execute(array $item, int $notify = 0, array $taglist = [], array $attachments = [], int $preparation_mode = Post\Delayed::PREPARED, string $uri = '')
|
||||
{
|
||||
$id = Post\Delayed::publish($item, $notify, $taglist, $attachments, $unprepared, $uri);
|
||||
Logger::notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'notify' => $notify, 'unprepared' => $unprepared]);
|
||||
$id = Post\Delayed::publish($item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
||||
Logger::notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'notify' => $notify, 'unprepared' => $preparation_mode]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1431);
|
||||
define('DB_UPDATE_VERSION', 1432);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -184,7 +184,8 @@ return [
|
|||
"about" => ["type" => "text", "comment" => ""],
|
||||
"keywords" => ["type" => "text", "comment" => "public keywords (interests) of the contact"],
|
||||
"gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
|
||||
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "XMPP address"],
|
||||
"matrix" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Matrix address"],
|
||||
"attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"photo" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo of the contact"],
|
||||
|
@ -1384,7 +1385,8 @@ return [
|
|||
"education" => ["type" => "text", "comment" => "Deprecated"],
|
||||
"contact" => ["type" => "text", "comment" => "Deprecated"],
|
||||
"homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "XMPP address"],
|
||||
"matrix" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Matrix address"],
|
||||
"photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
|
||||
|
|
|
@ -713,6 +713,7 @@
|
|||
"keywords" => ["contact", "keywords"],
|
||||
"gender" => ["contact", "gender"],
|
||||
"xmpp" => ["contact", "xmpp"],
|
||||
"matrix" => ["contact", "matrix"],
|
||||
"attag" => ["contact", "attag"],
|
||||
"avatar" => ["contact", "avatar"],
|
||||
"photo" => ["contact", "photo"],
|
||||
|
@ -837,6 +838,7 @@
|
|||
"about" => ["contact", "about"],
|
||||
"keywords" => ["contact", "keywords"],
|
||||
"xmpp" => ["contact", "xmpp"],
|
||||
"matrix" => ["contact", "matrix"],
|
||||
"avatar" => ["contact", "avatar"],
|
||||
"photo" => ["contact", "photo"],
|
||||
"thumb" => ["contact", "thumb"],
|
||||
|
@ -918,6 +920,7 @@
|
|||
"about" => ["contact", "about"],
|
||||
"keywords" => ["contact", "keywords"],
|
||||
"xmpp" => ["contact", "xmpp"],
|
||||
"matrix" => ["contact", "matrix"],
|
||||
"avatar" => ["contact", "avatar"],
|
||||
"photo" => ["contact", "photo"],
|
||||
"thumb" => ["contact", "thumb"],
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -51,6 +51,7 @@
|
|||
<dl><dt>{{$profileurllabel}}</dt><dd><a target="blank" href="{{$url}}">{{$profileurl}}</a></dd></dl>
|
||||
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location nofilter}}</dd></dl>{{/if}}
|
||||
{{if $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}}
|
||||
{{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}}
|
||||
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
|
||||
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about nofilter}}</dd></dl>{{/if}}
|
||||
</div>{{* End of contact-edit-links *}}
|
||||
|
|
|
@ -77,6 +77,14 @@
|
|||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $basic_fields.matrix}}
|
||||
<dl id="aprofile-matrix" class="row {{$basic_fields.matrix.class|default:'aprofile'}}">
|
||||
<hr class="profile-separator">
|
||||
<dt class="col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted">{{$basic_fields.matrix.label}}</dt>
|
||||
<dd class="col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry">{{$basic_fields.matrix.value nofilter}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $basic_fields.pub_keywords}}
|
||||
<dl id="aprofile-tags" class="row {{$basic_fields.pub_keywords.class|default:'aprofile'}}">
|
||||
<hr class="profile-separator">
|
||||
|
|
|
@ -29,6 +29,13 @@
|
|||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.matrix}}
|
||||
<dl class="matrix">
|
||||
<dt class="matrix-label">{{$matrix}}</dt>
|
||||
<dd class="matrix-data">{{$profile.matrix}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.upubkey}}<div class="key u-key" style="display:none;">{{$profile.upubkey}}</div>{{/if}}
|
||||
|
||||
{{if $contacts}}<div class="contacts" style="display:none;">{{$contacts}}</div>{{/if}}
|
||||
|
|
|
@ -80,6 +80,12 @@
|
|||
</div>
|
||||
<div id="profile-edit-xmpp-desc">{{$xmpp.3}}</div>
|
||||
<div id="profile-edit-xmpp-end"></div>
|
||||
<div id="profile-edit-matrix-wrapper">
|
||||
<label id="profile-edit-matrix-label" for="profile-edit-matrix">{{$matrix.1}} </label>
|
||||
<input type="text" size="32" name="matrix" id="profile-edit-matrix" title="{{$lbl_ex2}}" value="{{$matrix.2}}"/>
|
||||
</div>
|
||||
<div id="profile-edit-matrix-desc">{{$matrix.3}}</div>
|
||||
<div id="profile-edit-matrix-end"></div>
|
||||
<div id="profile-edit-pubkeywords-wrapper">
|
||||
<label id="profile-edit-pubkeywords-label" for="profile-edit-pubkeywords">{{$pub_keywords.1}} </label>
|
||||
<input type="text" size="32" name="pub_keywords" id="profile-edit-pubkeywords" title="{{$lbl_ex2}}" value="{{$pub_keywords.2}}"/>
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
<dd class="xmpp-data">{{$contact.xmpp}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{if $contact.matrix}}
|
||||
<dl class="matrix">
|
||||
<dt class="matrix-label">{{$matrix}}</dt>
|
||||
<dd class="matrix-data">{{$contact.matrix}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{if $contact.location}}
|
||||
<dl class="location" dir="auto">
|
||||
<dt class="location-label">{{$location}}</dt>
|
||||
|
|
|
@ -1167,7 +1167,7 @@ aside .vcard .detail {
|
|||
display: table;
|
||||
padding: 2px 0;
|
||||
}
|
||||
aside .xmpp {
|
||||
aside .xmpp, aside .matrix {
|
||||
display: table;
|
||||
}
|
||||
aside .vcard .icon {
|
||||
|
|
|
@ -96,6 +96,14 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $matrix}}
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<hr class="profile-separator">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$matrix_label}}</div>
|
||||
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">{{$matrix}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $keywords}}
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<hr class="profile-separator">
|
||||
|
|
|
@ -88,11 +88,18 @@
|
|||
|
||||
{{if $profile.xmpp}}
|
||||
<div class="xmpp">
|
||||
<span class="xmpp-label icon"><i class="fa fa-comments"></i></span>
|
||||
<span class="xmpp-label icon"><i class="fa fa-xmpp"></i></span>
|
||||
<span class="xmpp-data"><a href="xmpp:{{$profile.xmpp}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$profile.xmpp}}</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.matrix}}
|
||||
<div class="matrix">
|
||||
<span class="matrix-label icon"><i class="fa fa-matrix-org"></i></span>
|
||||
<span class="matrix-data"><a href="matrix:{{$profile.matrix}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$profile.matrix}}</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.upubkey}}<div class="key u-key" style="display:none;">{{$profile.upubkey}}</div>{{/if}}
|
||||
|
||||
{{if $contacts}}<div class="contacts" style="display:none;">{{$contacts}}</div>{{/if}}
|
||||
|
@ -101,7 +108,7 @@
|
|||
|
||||
{{if $homepage}}
|
||||
<div class="homepage detail">
|
||||
<span class="homepage-label icon"><i class="fa fa-external-link-square"></i></span>
|
||||
<span class="homepage-label icon"><i class="fa fa-external-link"></i></span>
|
||||
<span class="homepage-url u-url"><a href="{{$profile.homepage}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$profile.homepage}}</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -129,6 +129,8 @@
|
|||
|
||||
{{include file="field_input.tpl" field=$xmpp}}
|
||||
|
||||
{{include file="field_input.tpl" field=$matrix}}
|
||||
|
||||
{{include file="field_input.tpl" field=$pub_keywords}}
|
||||
|
||||
{{include file="field_input.tpl" field=$prv_keywords}}
|
||||
|
|
|
@ -69,11 +69,18 @@
|
|||
|
||||
{{if $contact.xmpp}}
|
||||
<div class="xmpp detail">
|
||||
<span class="xmpp-label icon"><i class="fa fa-comments"></i></span>
|
||||
<span class="xmpp-label icon"><i class="fa fa-xmpp"></i></span>
|
||||
<span class="xmpp-data"><a href="xmpp:{{$contact.xmpp}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$contact.xmpp}}</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $contact.matrix}}
|
||||
<div class="matrix detail">
|
||||
<span class="matrix-label icon"><i class="fa fa-matrix-org"></i></span>
|
||||
<span class="matrix-data"><a href="matrix:{{$contact.matrix}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$contact.matrix}}</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if $network_link}}
|
||||
<div class="network detail">
|
||||
<span class="network-label icon"><i class="fa fa-{{$network_avatar}}"></i></span>
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.matrix}}
|
||||
<dl class="matrix">
|
||||
<dt class="matrix-label">{{$matrix}}</dt>
|
||||
<dd class="matrix-data">{{$profile.matrix}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.upubkey}}<div class="key" style="display:none;">{{$profile.upubkey}}</div>{{/if}}
|
||||
|
||||
{{if $homepage}}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<dl><dt>{{$profileurllabel}}</dt><dd><a target="blank" href="{{$url}}">{{$profileurl}}</a></dd></dl>
|
||||
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location nofilter}}</dd></dl>{{/if}}
|
||||
{{if $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}}
|
||||
{{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}}
|
||||
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
|
||||
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about nofilter}}</dd></dl>{{/if}}
|
||||
</div>{{* End of contact-edit-links *}}
|
||||
|
|
|
@ -36,6 +36,13 @@
|
|||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.matrix}}
|
||||
<dl class="matrix">
|
||||
<dt class="matrix-label">{{$matrix}}</dt>
|
||||
<dd class="matrix-data">{{$profile.matrix}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $profile.upubkey}}<div class="key u-key" style="display:none;">{{$profile.upubkey}}</div>{{/if}}
|
||||
|
||||
{{if $contacts}}<div class="contacts" style="display:none;">{{$contacts}}</div>{{/if}}
|
||||
|
|
|
@ -67,6 +67,13 @@
|
|||
<div id="profile-edit-xmpp-desc">{{$xmpp.3}}</div>
|
||||
<div id="profile-edit-xmpp-end"></div>
|
||||
|
||||
<div id="profile-edit-matrix-wrapper">
|
||||
<label id="profile-edit-matrix-label" for="profile-edit-matrix">{{$matrix.1}} </label>
|
||||
<input type="text" size="32" name="matrix" id="profile-edit-matrix" value="{{$matrix.2}}"/>
|
||||
</div>
|
||||
<div id="profile-edit-matrix-desc">{{$matrix.3}}</div>
|
||||
<div id="profile-edit-matrix-end"></div>
|
||||
|
||||
<div id="profile-edit-homepage-wrapper">
|
||||
<label id="profile-edit-homepage-label" for="profile-edit-homepage">{{$homepage.1}} </label>
|
||||
<input type="text" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage.2}}"/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user