mirror of
https://github.com/friendica/friendica
synced 2025-02-05 19:38:52 +00:00
Fix code style
This commit is contained in:
parent
d4697a17a3
commit
0e59dba914
102 changed files with 3038 additions and 2764 deletions
|
@ -151,7 +151,7 @@ function photos_post()
|
||||||
if ($visibility === 'public') {
|
if ($visibility === 'public') {
|
||||||
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
||||||
$str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
|
$str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
|
||||||
} else if ($visibility === 'custom') {
|
} elseif ($visibility === 'custom') {
|
||||||
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
||||||
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
||||||
// See https://github.com/friendica/friendica/issues/9672
|
// See https://github.com/friendica/friendica/issues/9672
|
||||||
|
@ -1026,7 +1026,7 @@ function photos_content()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$edit = Null;
|
$edit = null;
|
||||||
if ($cmd === 'edit' && $can_post) {
|
if ($cmd === 'edit' && $can_post) {
|
||||||
$edit_tpl = Renderer::getMarkupTemplate('photo_edit.tpl');
|
$edit_tpl = Renderer::getMarkupTemplate('photo_edit.tpl');
|
||||||
|
|
||||||
|
|
|
@ -878,7 +878,7 @@ class Item
|
||||||
if ($visibility === 'public') {
|
if ($visibility === 'public') {
|
||||||
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
||||||
$post['allow_cid'] = $post['allow_gid'] = $post['deny_cid'] = $post['deny_gid'] = '';
|
$post['allow_cid'] = $post['allow_gid'] = $post['deny_cid'] = $post['deny_gid'] = '';
|
||||||
} else if ($visibility === 'custom') {
|
} elseif ($visibility === 'custom') {
|
||||||
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
||||||
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
||||||
// See https://github.com/friendica/friendica/issues/9672
|
// See https://github.com/friendica/friendica/issues/9672
|
||||||
|
|
|
@ -215,8 +215,11 @@ class PageInfo
|
||||||
|
|
||||||
$taglist = [];
|
$taglist = [];
|
||||||
foreach ($data['keywords'] as $keyword) {
|
foreach ($data['keywords'] as $keyword) {
|
||||||
$hashtag = str_replace([' ', '+', '/', '.', '#', "'"],
|
$hashtag = str_replace(
|
||||||
['', '', '', '', '', ''], $keyword);
|
[' ', '+', '/', '.', '#', "'"],
|
||||||
|
['', '', '', '', '', ''],
|
||||||
|
$keyword
|
||||||
|
);
|
||||||
|
|
||||||
$taglist[] = $hashtag;
|
$taglist[] = $hashtag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,7 @@ class BBCode
|
||||||
$value = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
$value = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
||||||
$data['title'] = self::escapeContent($value);
|
$data['title'] = self::escapeContent($value);
|
||||||
|
|
||||||
|
// no break
|
||||||
default:
|
default:
|
||||||
$data[$field] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
$data[$field] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,7 +24,8 @@ class Markdown
|
||||||
* @param string $baseuri Optional. Prepend anchor links with this URL
|
* @param string $baseuri Optional. Prepend anchor links with this URL
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function convert($text, $hardwrap = true, $baseuri = null) {
|
public static function convert($text, $hardwrap = true, $baseuri = null)
|
||||||
|
{
|
||||||
DI::profiler()->startRecording('rendering');
|
DI::profiler()->startRecording('rendering');
|
||||||
|
|
||||||
$MarkdownParser = new MarkdownParser();
|
$MarkdownParser = new MarkdownParser();
|
||||||
|
@ -121,10 +122,10 @@ class Markdown
|
||||||
|
|
||||||
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
|
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
|
||||||
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism', '[youtube]$2[/youtube]', 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism', '[youtube]$2[/youtube]', 'url', $s);
|
||||||
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism' , '[youtube]$1[/youtube]', 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism', '[youtube]$1[/youtube]', 'url', $s);
|
||||||
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/www.youtube.com\/shorts\/(.*?)\].*?\[\/url\]/ism' , '[youtube]$1[/youtube]', 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/www.youtube.com\/shorts\/(.*?)\].*?\[\/url\]/ism', '[youtube]$1[/youtube]', 'url', $s);
|
||||||
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism' , '[vimeo]$2[/vimeo]' , 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism', '[vimeo]$2[/vimeo]', 'url', $s);
|
||||||
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism' , '[vimeo]$1[/vimeo]' , 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism', '[vimeo]$1[/vimeo]', 'url', $s);
|
||||||
|
|
||||||
// remove duplicate adjacent code tags
|
// remove duplicate adjacent code tags
|
||||||
$s = preg_replace('/(\[code\])+(.*?)(\[\/code\])+/ism', '[code]$2[/code]', $s);
|
$s = preg_replace('/(\[code\])+(.*?)(\[\/code\])+/ism', '[code]$2[/code]', $s);
|
||||||
|
|
|
@ -203,8 +203,11 @@ class Update
|
||||||
// run the pre_update_nnnn functions in update.php
|
// run the pre_update_nnnn functions in update.php
|
||||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||||
DI::logger()->notice('Execute pre update.', ['version' => $version]);
|
DI::logger()->notice('Execute pre update.', ['version' => $version]);
|
||||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing pre update %d',
|
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t(
|
||||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
'%s: executing pre update %d',
|
||||||
|
DateTimeFormat::utcNow() . ' ' . date('e'),
|
||||||
|
$version
|
||||||
|
));
|
||||||
$r = self::runUpdateFunction($version, 'pre_update', $sendMail);
|
$r = self::runUpdateFunction($version, 'pre_update', $sendMail);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
DI::logger()->warning('Pre update failed', ['version' => $version]);
|
DI::logger()->warning('Pre update failed', ['version' => $version]);
|
||||||
|
@ -245,8 +248,11 @@ class Update
|
||||||
// run the update_nnnn functions in update.php
|
// run the update_nnnn functions in update.php
|
||||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||||
DI::logger()->notice('Execute post update.', ['version' => $version]);
|
DI::logger()->notice('Execute post update.', ['version' => $version]);
|
||||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing post update %d',
|
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t(
|
||||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
'%s: executing post update %d',
|
||||||
|
DateTimeFormat::utcNow() . ' ' . date('e'),
|
||||||
|
$version
|
||||||
|
));
|
||||||
$r = self::runUpdateFunction($version, 'update', $sendMail);
|
$r = self::runUpdateFunction($version, 'update', $sendMail);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
DI::logger()->warning('Post update failed', ['version' => $version]);
|
DI::logger()->warning('Post update failed', ['version' => $version]);
|
||||||
|
@ -359,12 +365,14 @@ class Update
|
||||||
foreach($adminEmails as $admin) {
|
foreach($adminEmails as $admin) {
|
||||||
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
||||||
|
|
||||||
$preamble = Strings::deindent($l10n->t("
|
$preamble = Strings::deindent($l10n->t(
|
||||||
|
"
|
||||||
The friendica developers released update %s recently,
|
The friendica developers released update %s recently,
|
||||||
but when I tried to install it, something went terribly wrong.
|
but when I tried to install it, something went terribly wrong.
|
||||||
This needs to be fixed soon and I can't do it alone. Please contact a
|
This needs to be fixed soon and I can't do it alone. Please contact a
|
||||||
friendica developer if you can not help me on your own. My database might be invalid.",
|
friendica developer if you can not help me on your own. My database might be invalid.",
|
||||||
$update_id));
|
$update_id
|
||||||
|
));
|
||||||
$body = $l10n->t('The error message is\n[pre]%s[/pre]', $error_message);
|
$body = $l10n->t('The error message is\n[pre]%s[/pre]', $error_message);
|
||||||
|
|
||||||
$email = DI::emailer()
|
$email = DI::emailer()
|
||||||
|
@ -391,9 +399,12 @@ class Update
|
||||||
foreach(User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin) {
|
foreach(User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin) {
|
||||||
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
||||||
|
|
||||||
$preamble = Strings::deindent($l10n->t('
|
$preamble = Strings::deindent($l10n->t(
|
||||||
|
'
|
||||||
The friendica database was successfully updated from %s to %s.',
|
The friendica database was successfully updated from %s to %s.',
|
||||||
$from_build, $to_build));
|
$from_build,
|
||||||
|
$to_build
|
||||||
|
));
|
||||||
|
|
||||||
$email = DI::emailer()
|
$email = DI::emailer()
|
||||||
->newSystemMail()
|
->newSystemMail()
|
||||||
|
|
|
@ -112,7 +112,10 @@ class Cron
|
||||||
} elseif ($entry['priority'] != Worker::PRIORITY_CRITICAL) {
|
} elseif ($entry['priority'] != Worker::PRIORITY_CRITICAL) {
|
||||||
$new_priority = Worker::PRIORITY_NEGLIGIBLE;
|
$new_priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]]
|
DBA::update(
|
||||||
|
'workerqueue',
|
||||||
|
['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
||||||
|
['id' => $entry["id"]]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
DI::logger()->info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
|
DI::logger()->info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
|
||||||
|
|
|
@ -73,8 +73,11 @@ class DBStructure
|
||||||
'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge',
|
'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge',
|
||||||
'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'addon', 'push_subscriber'];
|
'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'addon', 'push_subscriber'];
|
||||||
|
|
||||||
$tables = DBA::selectToArray('INFORMATION_SCHEMA.TABLES', ['TABLE_NAME'],
|
$tables = DBA::selectToArray(
|
||||||
['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']);
|
'INFORMATION_SCHEMA.TABLES',
|
||||||
|
['TABLE_NAME'],
|
||||||
|
['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']
|
||||||
|
);
|
||||||
|
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
echo DI::l10n()->t('No unused tables found.');
|
echo DI::l10n()->t('No unused tables found.');
|
||||||
|
@ -143,8 +146,11 @@ class DBStructure
|
||||||
*/
|
*/
|
||||||
private static function printUpdateError(string $message): string
|
private static function printUpdateError(string $message): string
|
||||||
{
|
{
|
||||||
echo DI::l10n()->t("\nError %d occurred during database update:\n%s\n",
|
echo DI::l10n()->t(
|
||||||
DBA::errorNo(), DBA::errorMessage());
|
"\nError %d occurred during database update:\n%s\n",
|
||||||
|
DBA::errorNo(),
|
||||||
|
DBA::errorMessage()
|
||||||
|
);
|
||||||
|
|
||||||
return DI::l10n()->t('Errors encountered performing database changes: ') . $message . '<br />';
|
return DI::l10n()->t('Errors encountered performing database changes: ') . $message . '<br />';
|
||||||
}
|
}
|
||||||
|
@ -522,21 +528,27 @@ class DBStructure
|
||||||
// This query doesn't seem to be executable as a prepared statement
|
// This query doesn't seem to be executable as a prepared statement
|
||||||
$indexes = DBA::toArray(DBA::p("SHOW INDEX FROM " . DBA::quoteIdentifier($table)));
|
$indexes = DBA::toArray(DBA::p("SHOW INDEX FROM " . DBA::quoteIdentifier($table)));
|
||||||
|
|
||||||
$fields = DBA::selectToArray('INFORMATION_SCHEMA.COLUMNS',
|
$fields = DBA::selectToArray(
|
||||||
|
'INFORMATION_SCHEMA.COLUMNS',
|
||||||
['COLUMN_NAME', 'COLUMN_TYPE', 'IS_NULLABLE', 'COLUMN_DEFAULT', 'EXTRA',
|
['COLUMN_NAME', 'COLUMN_TYPE', 'IS_NULLABLE', 'COLUMN_DEFAULT', 'EXTRA',
|
||||||
'COLUMN_KEY', 'COLLATION_NAME', 'COLUMN_COMMENT'],
|
'COLUMN_KEY', 'COLLATION_NAME', 'COLUMN_COMMENT'],
|
||||||
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?",
|
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?",
|
||||||
DBA::databaseName(), $table]);
|
DBA::databaseName(), $table]
|
||||||
|
);
|
||||||
|
|
||||||
$foreign_keys = DBA::selectToArray('INFORMATION_SCHEMA.KEY_COLUMN_USAGE',
|
$foreign_keys = DBA::selectToArray(
|
||||||
|
'INFORMATION_SCHEMA.KEY_COLUMN_USAGE',
|
||||||
['COLUMN_NAME', 'CONSTRAINT_NAME', 'REFERENCED_TABLE_NAME', 'REFERENCED_COLUMN_NAME'],
|
['COLUMN_NAME', 'CONSTRAINT_NAME', 'REFERENCED_TABLE_NAME', 'REFERENCED_COLUMN_NAME'],
|
||||||
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `REFERENCED_TABLE_SCHEMA` IS NOT NULL",
|
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `REFERENCED_TABLE_SCHEMA` IS NOT NULL",
|
||||||
DBA::databaseName(), $table]);
|
DBA::databaseName(), $table]
|
||||||
|
);
|
||||||
|
|
||||||
$table_status = DBA::selectFirst('INFORMATION_SCHEMA.TABLES',
|
$table_status = DBA::selectFirst(
|
||||||
|
'INFORMATION_SCHEMA.TABLES',
|
||||||
['ENGINE', 'TABLE_COLLATION', 'TABLE_COMMENT'],
|
['ENGINE', 'TABLE_COLLATION', 'TABLE_COMMENT'],
|
||||||
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?",
|
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?",
|
||||||
DBA::databaseName(), $table]);
|
DBA::databaseName(), $table]
|
||||||
|
);
|
||||||
|
|
||||||
$fielddata = [];
|
$fielddata = [];
|
||||||
$indexdata = [];
|
$indexdata = [];
|
||||||
|
@ -731,9 +743,11 @@ class DBStructure
|
||||||
*/
|
*/
|
||||||
public static function existsForeignKeyForField(string $table, string $field): bool
|
public static function existsForeignKeyForField(string $table, string $field): bool
|
||||||
{
|
{
|
||||||
return DBA::exists('INFORMATION_SCHEMA.KEY_COLUMN_USAGE',
|
return DBA::exists(
|
||||||
|
'INFORMATION_SCHEMA.KEY_COLUMN_USAGE',
|
||||||
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? AND `REFERENCED_TABLE_SCHEMA` IS NOT NULL",
|
["`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? AND `REFERENCED_TABLE_SCHEMA` IS NOT NULL",
|
||||||
DBA::databaseName(), $table, $field]);
|
DBA::databaseName(), $table, $field]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -174,12 +174,19 @@ class PostUpdate
|
||||||
|
|
||||||
DI::logger()->info('Start');
|
DI::logger()->info('Start');
|
||||||
|
|
||||||
$contacts = DBA::p("SELECT `nurl`, `uid` FROM `contact`
|
$contacts = DBA::p(
|
||||||
|
"SELECT `nurl`, `uid` FROM `contact`
|
||||||
WHERE EXISTS (SELECT `nurl` FROM `contact` AS `c2`
|
WHERE EXISTS (SELECT `nurl` FROM `contact` AS `c2`
|
||||||
WHERE `c2`.`nurl` = `contact`.`nurl` AND `c2`.`id` != `contact`.`id` AND `c2`.`uid` = `contact`.`uid` AND `c2`.`network` IN (?, ?, ?) AND NOT `deleted`)
|
WHERE `c2`.`nurl` = `contact`.`nurl` AND `c2`.`id` != `contact`.`id` AND `c2`.`uid` = `contact`.`uid` AND `c2`.`network` IN (?, ?, ?) AND NOT `deleted`)
|
||||||
AND (`network` IN (?, ?, ?) OR (`uid` = ?)) AND NOT `deleted` GROUP BY `nurl`, `uid`",
|
AND (`network` IN (?, ?, ?) OR (`uid` = ?)) AND NOT `deleted` GROUP BY `nurl`, `uid`",
|
||||||
Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB,
|
Protocol::DIASPORA,
|
||||||
Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB, 0);
|
Protocol::OSTATUS,
|
||||||
|
Protocol::ACTIVITYPUB,
|
||||||
|
Protocol::DIASPORA,
|
||||||
|
Protocol::OSTATUS,
|
||||||
|
Protocol::ACTIVITYPUB,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
DI::logger()->info('Remove duplicates', ['nurl' => $contact['nurl'], 'uid' => $contact['uid']]);
|
DI::logger()->info('Remove duplicates', ['nurl' => $contact['nurl'], 'uid' => $contact['uid']]);
|
||||||
|
@ -331,12 +338,18 @@ class PostUpdate
|
||||||
|
|
||||||
$rows = 0;
|
$rows = 0;
|
||||||
|
|
||||||
$terms = DBA::p("SELECT `term`.`tid`, `item`.`uri-id`, `term`.`type`, `term`.`term`, `term`.`url`, `item-content`.`body`
|
$terms = DBA::p(
|
||||||
|
"SELECT `term`.`tid`, `item`.`uri-id`, `term`.`type`, `term`.`term`, `term`.`url`, `item-content`.`body`
|
||||||
FROM `term`
|
FROM `term`
|
||||||
INNER JOIN `item` ON `item`.`id` = `term`.`oid`
|
INNER JOIN `item` ON `item`.`id` = `term`.`oid`
|
||||||
INNER JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
|
INNER JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
|
||||||
WHERE term.type IN (?, ?, ?, ?) AND `tid` >= ? ORDER BY `tid` LIMIT 100000",
|
WHERE term.type IN (?, ?, ?, ?) AND `tid` >= ? ORDER BY `tid` LIMIT 100000",
|
||||||
Tag::HASHTAG, Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION, $id);
|
Tag::HASHTAG,
|
||||||
|
Tag::MENTION,
|
||||||
|
Tag::EXCLUSIVE_MENTION,
|
||||||
|
Tag::IMPLICIT_MENTION,
|
||||||
|
$id
|
||||||
|
);
|
||||||
|
|
||||||
if (DBA::errorNo() != 0) {
|
if (DBA::errorNo() != 0) {
|
||||||
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
||||||
|
@ -490,9 +503,12 @@ class PostUpdate
|
||||||
|
|
||||||
$rows = 0;
|
$rows = 0;
|
||||||
|
|
||||||
$terms = DBA::select('term', ['oid'],
|
$terms = DBA::select(
|
||||||
|
'term',
|
||||||
|
['oid'],
|
||||||
["`type` IN (?, ?) AND `oid` >= ?", Category::CATEGORY, Category::FILE, $id],
|
["`type` IN (?, ?) AND `oid` >= ?", Category::CATEGORY, Category::FILE, $id],
|
||||||
['order' => ['oid'], 'limit' => 1000, 'group_by' => ['oid']]);
|
['order' => ['oid'], 'limit' => 1000, 'group_by' => ['oid']]
|
||||||
|
);
|
||||||
|
|
||||||
if (DBA::errorNo() != 0) {
|
if (DBA::errorNo() != 0) {
|
||||||
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
||||||
|
@ -632,9 +648,11 @@ class PostUpdate
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$id = $contact['id'];
|
$id = $contact['id'];
|
||||||
|
|
||||||
DBA::update('contact',
|
DBA::update(
|
||||||
|
'contact',
|
||||||
['gsid' => GServer::getID($contact['baseurl'], true), 'baseurl' => GServer::cleanURL($contact['baseurl'])],
|
['gsid' => GServer::getID($contact['baseurl'], true), 'baseurl' => GServer::cleanURL($contact['baseurl'])],
|
||||||
['id' => $contact['id']]);
|
['id' => $contact['id']]
|
||||||
|
);
|
||||||
|
|
||||||
++$rows;
|
++$rows;
|
||||||
}
|
}
|
||||||
|
@ -685,9 +703,11 @@ class PostUpdate
|
||||||
while ($apcontact = DBA::fetch($apcontacts)) {
|
while ($apcontact = DBA::fetch($apcontacts)) {
|
||||||
$id = $apcontact['url'];
|
$id = $apcontact['url'];
|
||||||
|
|
||||||
DBA::update('apcontact',
|
DBA::update(
|
||||||
|
'apcontact',
|
||||||
['gsid' => GServer::getID($apcontact['baseurl'], true), 'baseurl' => GServer::cleanURL($apcontact['baseurl'])],
|
['gsid' => GServer::getID($apcontact['baseurl'], true), 'baseurl' => GServer::cleanURL($apcontact['baseurl'])],
|
||||||
['url' => $apcontact['url']]);
|
['url' => $apcontact['url']]
|
||||||
|
);
|
||||||
|
|
||||||
++$rows;
|
++$rows;
|
||||||
}
|
}
|
||||||
|
@ -1053,10 +1073,14 @@ class PostUpdate
|
||||||
$rows = 0;
|
$rows = 0;
|
||||||
$received = '';
|
$received = '';
|
||||||
|
|
||||||
$conversations = DBA::p("SELECT `post-view`.`uri-id`, `conversation`.`source`, `conversation`.`received` FROM `conversation`
|
$conversations = DBA::p(
|
||||||
|
"SELECT `post-view`.`uri-id`, `conversation`.`source`, `conversation`.`received` FROM `conversation`
|
||||||
INNER JOIN `post-view` ON `post-view`.`uri` = `conversation`.`item-uri`
|
INNER JOIN `post-view` ON `post-view`.`uri` = `conversation`.`item-uri`
|
||||||
WHERE NOT `source` IS NULL AND `conversation`.`protocol` = ? AND `uri-id` > ? LIMIT ?",
|
WHERE NOT `source` IS NULL AND `conversation`.`protocol` = ? AND `uri-id` > ? LIMIT ?",
|
||||||
Conversation::PARCEL_ACTIVITYPUB, $id, 1000);
|
Conversation::PARCEL_ACTIVITYPUB,
|
||||||
|
$id,
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
|
||||||
if (DBA::errorNo() != 0) {
|
if (DBA::errorNo() != 0) {
|
||||||
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
DI::logger()->error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
||||||
|
@ -1217,9 +1241,11 @@ class PostUpdate
|
||||||
unset($parts['path']);
|
unset($parts['path']);
|
||||||
$server = (string)Uri::fromParts($parts);
|
$server = (string)Uri::fromParts($parts);
|
||||||
|
|
||||||
DBA::update('contact',
|
DBA::update(
|
||||||
|
'contact',
|
||||||
['gsid' => GServer::getID($server, true), 'baseurl' => GServer::cleanURL($server)],
|
['gsid' => GServer::getID($server, true), 'baseurl' => GServer::cleanURL($server)],
|
||||||
['id' => $contact['id']]);
|
['id' => $contact['id']]
|
||||||
|
);
|
||||||
|
|
||||||
++$rows;
|
++$rows;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Item;
|
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
use Friendica\Protocol\ActivityNamespace;
|
||||||
|
|
|
@ -163,7 +163,8 @@ class Circle
|
||||||
*/
|
*/
|
||||||
public static function countUnseen(int $uid)
|
public static function countUnseen(int $uid)
|
||||||
{
|
{
|
||||||
$stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`,
|
$stmt = DBA::p(
|
||||||
|
"SELECT `circle`.`id`, `circle`.`name`,
|
||||||
(SELECT COUNT(*) FROM `post-user`
|
(SELECT COUNT(*) FROM `post-user`
|
||||||
WHERE `uid` = ?
|
WHERE `uid` = ?
|
||||||
AND `unseen`
|
AND `unseen`
|
||||||
|
|
|
@ -300,7 +300,7 @@ class Relation
|
||||||
* @param integer $uid
|
* @param integer $uid
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
static public function areSuggestionsOutdated(int $uid): bool
|
public static function areSuggestionsOutdated(int $uid): bool
|
||||||
{
|
{
|
||||||
return DI::pConfig()->get($uid, 'suggestion', 'last_update') + 3600 < time();
|
return DI::pConfig()->get($uid, 'suggestion', 'last_update') + 3600 < time();
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ class Relation
|
||||||
* @param integer $uid
|
* @param integer $uid
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function updateCachedSuggestions(int $uid)
|
public static function updateCachedSuggestions(int $uid)
|
||||||
{
|
{
|
||||||
if (!self::areSuggestionsOutdated($uid)) {
|
if (!self::areSuggestionsOutdated($uid)) {
|
||||||
return;
|
return;
|
||||||
|
@ -334,7 +334,7 @@ class Relation
|
||||||
* @param int $limit optional, default 80
|
* @param int $limit optional, default 80
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static public function getCachedSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
public static function getCachedSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
||||||
{
|
{
|
||||||
$condition = ["`uid` = ? AND `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE NOT `ignore` AND `uid` = ?)", 0, $uid];
|
$condition = ["`uid` = ? AND `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE NOT `ignore` AND `uid` = ?)", 0, $uid];
|
||||||
$params = ['limit' => [$start, $limit]];
|
$params = ['limit' => [$start, $limit]];
|
||||||
|
@ -355,7 +355,7 @@ class Relation
|
||||||
* @param int $limit optional, default 80
|
* @param int $limit optional, default 80
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static public function getSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
public static function getSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
||||||
{
|
{
|
||||||
if ($uid == 0) {
|
if ($uid == 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -371,7 +371,10 @@ class Relation
|
||||||
|
|
||||||
// The query returns contacts where contacts interacted with whom the given user follows.
|
// The query returns contacts where contacts interacted with whom the given user follows.
|
||||||
// Contacts who already are in the user's contact table are ignored.
|
// Contacts who already are in the user's contact table are ignored.
|
||||||
$results = DBA::select('contact', [], ["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` IN
|
$results = DBA::select(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
|
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` IN
|
||||||
(SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
|
(SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
|
||||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
||||||
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
|
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
|
||||||
|
@ -381,7 +384,8 @@ class Relation
|
||||||
0,
|
0,
|
||||||
$uid, Contact::FRIEND, Contact::SHARING,
|
$uid, Contact::FRIEND, Contact::SHARING,
|
||||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid
|
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid
|
||||||
], [
|
],
|
||||||
|
[
|
||||||
'order' => ['last-item' => true],
|
'order' => ['last-item' => true],
|
||||||
'limit' => $totallimit,
|
'limit' => $totallimit,
|
||||||
]
|
]
|
||||||
|
@ -401,7 +405,9 @@ class Relation
|
||||||
|
|
||||||
// The query returns contacts where contacts interacted with whom also interacted with the given user.
|
// The query returns contacts where contacts interacted with whom also interacted with the given user.
|
||||||
// Contacts who already are in the user's contact table are ignored.
|
// Contacts who already are in the user's contact table are ignored.
|
||||||
$results = DBA::select('contact', [],
|
$results = DBA::select(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` IN
|
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` IN
|
||||||
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
|
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
|
||||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
||||||
|
@ -425,7 +431,9 @@ class Relation
|
||||||
}
|
}
|
||||||
|
|
||||||
// The query returns contacts that follow the given user but aren't followed by that user.
|
// The query returns contacts that follow the given user but aren't followed by that user.
|
||||||
$results = DBA::select('contact', [],
|
$results = DBA::select(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` = ?)
|
["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` = ?)
|
||||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
||||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||||
|
@ -446,7 +454,9 @@ class Relation
|
||||||
}
|
}
|
||||||
|
|
||||||
// The query returns any contact that isn't followed by that user.
|
// The query returns any contact that isn't followed by that user.
|
||||||
$results = DBA::select('contact', [],
|
$results = DBA::select(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
["NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?) AND `nurl` = `nurl`)
|
["NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?) AND `nurl` = `nurl`)
|
||||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
||||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||||
|
@ -712,7 +722,8 @@ class Relation
|
||||||
*/
|
*/
|
||||||
public static function countCommonFollows(int $sourceId, int $targetId, array $condition = []): int
|
public static function countCommonFollows(int $sourceId, int $targetId, array $condition = []): int
|
||||||
{
|
{
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
['`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
['`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||||
AND `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)',
|
AND `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)',
|
||||||
$sourceId, $targetId]
|
$sourceId, $targetId]
|
||||||
|
@ -735,13 +746,17 @@ class Relation
|
||||||
*/
|
*/
|
||||||
public static function listCommonFollows(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
|
public static function listCommonFollows(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
|
||||||
{
|
{
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
|
||||||
AND `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)",
|
AND `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)",
|
||||||
$sourceId, $targetId]
|
$sourceId, $targetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
return DI::dba()->selectToArray('contact', [], $condition,
|
return DI::dba()->selectToArray(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
|
$condition,
|
||||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -757,7 +772,8 @@ class Relation
|
||||||
*/
|
*/
|
||||||
public static function countCommonFollowers(int $sourceId, int $targetId, array $condition = []): int
|
public static function countCommonFollowers(int $sourceId, int $targetId, array $condition = []): int
|
||||||
{
|
{
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)
|
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)
|
||||||
AND `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)",
|
AND `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)",
|
||||||
$sourceId, $targetId]
|
$sourceId, $targetId]
|
||||||
|
@ -780,13 +796,17 @@ class Relation
|
||||||
*/
|
*/
|
||||||
public static function listCommonFollowers(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
|
public static function listCommonFollowers(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
|
||||||
{
|
{
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)
|
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)
|
||||||
AND `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)",
|
AND `id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)",
|
||||||
$sourceId, $targetId]
|
$sourceId, $targetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
return DI::dba()->selectToArray('contact', [], $condition,
|
return DI::dba()->selectToArray(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
|
$condition,
|
||||||
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -810,67 +830,145 @@ class Relation
|
||||||
|
|
||||||
DBA::update('contact-relation', ['score' => 0, 'relation-score' => 0, 'thread-score' => 0, 'relation-thread-score' => 0], ['relation-cid' => $contact_id]);
|
DBA::update('contact-relation', ['score' => 0, 'relation-score' => 0, 'thread-score' => 0, 'relation-thread-score' => 0], ['relation-cid' => $contact_id]);
|
||||||
|
|
||||||
$total = DBA::fetchFirst("SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
$total = DBA::fetchFirst(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
|
|
||||||
DI::logger()->debug('Calculate relation-score', ['uid' => $uid, 'total' => $total['activity']]);
|
DI::logger()->debug('Calculate relation-score', ['uid' => $uid, 'total' => $total['activity']]);
|
||||||
|
|
||||||
$interactions = DBA::p("SELECT `post`.`author-id`, count(*) AS `activity`, EXISTS(SELECT `pid` FROM `account-user-view` WHERE `pid` = `post`.`author-id` AND `uid` = ? AND `rel` IN (?, ?)) AS `follows`
|
$interactions = DBA::p(
|
||||||
|
"SELECT `post`.`author-id`, count(*) AS `activity`, EXISTS(SELECT `pid` FROM `account-user-view` WHERE `pid` = `post`.`author-id` AND `uid` = ? AND `rel` IN (?, ?)) AS `follows`
|
||||||
FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
||||||
$uid, Contact::SHARING, Contact::FRIEND, $contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
$uid,
|
||||||
|
Contact::SHARING,
|
||||||
|
Contact::FRIEND,
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
while ($interaction = DBA::fetch($interactions)) {
|
while ($interaction = DBA::fetch($interactions)) {
|
||||||
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
||||||
DBA::update('contact-relation', ['relation-score' => $score, 'follows' => $interaction['follows']], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
DBA::update('contact-relation', ['relation-score' => $score, 'follows' => $interaction['follows']], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
||||||
}
|
}
|
||||||
DBA::close($interactions);
|
DBA::close($interactions);
|
||||||
|
|
||||||
$total = DBA::fetchFirst("SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
$total = DBA::fetchFirst(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
|
|
||||||
DI::logger()->debug('Calculate relation-thread-score', ['uid' => $uid, 'total' => $total['activity']]);
|
DI::logger()->debug('Calculate relation-thread-score', ['uid' => $uid, 'total' => $total['activity']]);
|
||||||
|
|
||||||
$interactions = DBA::p("SELECT `post`.`author-id`, count(*) AS `activity`, EXISTS(SELECT `pid` FROM `account-user-view` WHERE `pid` = `post`.`author-id` AND `uid` = ? AND `rel` IN (?, ?)) AS `follows`
|
$interactions = DBA::p(
|
||||||
|
"SELECT `post`.`author-id`, count(*) AS `activity`, EXISTS(SELECT `pid` FROM `account-user-view` WHERE `pid` = `post`.`author-id` AND `uid` = ? AND `rel` IN (?, ?)) AS `follows`
|
||||||
FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
FROM `post-user` INNER JOIN `post` ON `post`.`uri-id` = `post-user`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
||||||
$uid, Contact::SHARING, Contact::FRIEND, $contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
$uid,
|
||||||
|
Contact::SHARING,
|
||||||
|
Contact::FRIEND,
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
while ($interaction = DBA::fetch($interactions)) {
|
while ($interaction = DBA::fetch($interactions)) {
|
||||||
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
||||||
DBA::update('contact-relation', ['relation-thread-score' => $score, 'follows' => !empty($interaction['follows'])], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
DBA::update('contact-relation', ['relation-thread-score' => $score, 'follows' => !empty($interaction['follows'])], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
||||||
}
|
}
|
||||||
DBA::close($interactions);
|
DBA::close($interactions);
|
||||||
|
|
||||||
$total = DBA::fetchFirst("SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
$total = DBA::fetchFirst(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
|
|
||||||
DI::logger()->debug('Calculate score', ['uid' => $uid, 'total' => $total['activity']]);
|
DI::logger()->debug('Calculate score', ['uid' => $uid, 'total' => $total['activity']]);
|
||||||
|
|
||||||
$interactions = DBA::p("SELECT `post`.`author-id`, count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
$interactions = DBA::p(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT `post`.`author-id`, count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`thr-parent-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
while ($interaction = DBA::fetch($interactions)) {
|
while ($interaction = DBA::fetch($interactions)) {
|
||||||
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
||||||
DBA::update('contact-relation', ['score' => $score], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
DBA::update('contact-relation', ['score' => $score], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
||||||
}
|
}
|
||||||
DBA::close($interactions);
|
DBA::close($interactions);
|
||||||
|
|
||||||
$total = DBA::fetchFirst("SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
$total = DBA::fetchFirst(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?)",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
|
|
||||||
DI::logger()->debug('Calculate thread-score', ['uid' => $uid, 'total' => $total['activity']]);
|
DI::logger()->debug('Calculate thread-score', ['uid' => $uid, 'total' => $total['activity']]);
|
||||||
|
|
||||||
$interactions = DBA::p("SELECT `post`.`author-id`, count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
$interactions = DBA::p(
|
||||||
$contact_id, DateTimeFormat::utc('now - ' . $days . ' day'), $uid, $contact_id, $follow, $view, $read);
|
"SELECT `post`.`author-id`, count(*) AS `activity` FROM `post-user` INNER JOIN `post` ON `post-user`.`uri-id` = `post`.`parent-uri-id` WHERE `post-user`.`author-id` = ? AND `post-user`.`received` >= ? AND `post-user`.`uid` = ? AND `post`.`author-id` != ? AND NOT `post`.`vid` IN (?, ?, ?) GROUP BY `post`.`author-id`",
|
||||||
|
$contact_id,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day'),
|
||||||
|
$uid,
|
||||||
|
$contact_id,
|
||||||
|
$follow,
|
||||||
|
$view,
|
||||||
|
$read
|
||||||
|
);
|
||||||
while ($interaction = DBA::fetch($interactions)) {
|
while ($interaction = DBA::fetch($interactions)) {
|
||||||
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
$score = min((int)(($interaction['activity'] / $total['activity']) * 65535), 65535);
|
||||||
DBA::update('contact-relation', ['thread-score' => $score], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
DBA::update('contact-relation', ['thread-score' => $score], ['relation-cid' => $contact_id, 'cid' => $interaction['author-id']]);
|
||||||
}
|
}
|
||||||
DBA::close($interactions);
|
DBA::close($interactions);
|
||||||
|
|
||||||
$total = DBA::fetchFirst("SELECT count(*) AS `posts` FROM `post-thread-user` WHERE EXISTS(SELECT `cid` FROM `contact-relation` WHERE `cid` = `post-thread-user`.`author-id` AND `relation-cid` = ? AND `follows`) AND `uid` = ? AND `created` > ?",
|
$total = DBA::fetchFirst(
|
||||||
$contact_id, $uid, DateTimeFormat::utc('now - ' . $days . ' day'));
|
"SELECT count(*) AS `posts` FROM `post-thread-user` WHERE EXISTS(SELECT `cid` FROM `contact-relation` WHERE `cid` = `post-thread-user`.`author-id` AND `relation-cid` = ? AND `follows`) AND `uid` = ? AND `created` > ?",
|
||||||
|
$contact_id,
|
||||||
|
$uid,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day')
|
||||||
|
);
|
||||||
|
|
||||||
DI::logger()->debug('Calculate post-score', ['uid' => $uid, 'total' => $total['posts']]);
|
DI::logger()->debug('Calculate post-score', ['uid' => $uid, 'total' => $total['posts']]);
|
||||||
|
|
||||||
$posts = DBA::p("SELECT `author-id`, count(*) AS `posts` FROM `post-thread-user` WHERE EXISTS(SELECT `cid` FROM `contact-relation` WHERE `cid` = `post-thread-user`.`author-id` AND `relation-cid` = ? AND `follows`) AND `uid` = ? AND `created` > ? GROUP BY `author-id`",
|
$posts = DBA::p(
|
||||||
$contact_id, $uid, DateTimeFormat::utc('now - ' . $days . ' day'));
|
"SELECT `author-id`, count(*) AS `posts` FROM `post-thread-user` WHERE EXISTS(SELECT `cid` FROM `contact-relation` WHERE `cid` = `post-thread-user`.`author-id` AND `relation-cid` = ? AND `follows`) AND `uid` = ? AND `created` > ? GROUP BY `author-id`",
|
||||||
|
$contact_id,
|
||||||
|
$uid,
|
||||||
|
DateTimeFormat::utc('now - ' . $days . ' day')
|
||||||
|
);
|
||||||
while ($post = DBA::fetch($posts)) {
|
while ($post = DBA::fetch($posts)) {
|
||||||
$score = min((int)(($post['posts'] / $total['posts']) * 65535), 65535);
|
$score = min((int)(($post['posts'] / $total['posts']) * 65535), 65535);
|
||||||
DBA::update('contact-relation', ['post-score' => $score], ['relation-cid' => $contact_id, 'cid' => $post['author-id']]);
|
DBA::update('contact-relation', ['post-score' => $score], ['relation-cid' => $contact_id, 'cid' => $post['author-id']]);
|
||||||
|
|
|
@ -29,7 +29,6 @@ use Friendica\Util\XML;
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function getHTML(array $event, bool $simple = false, int $uriid = 0): string
|
public static function getHTML(array $event, bool $simple = false, int $uriid = 0): string
|
||||||
{
|
{
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
|
@ -654,7 +653,7 @@ class Event
|
||||||
|
|
||||||
$title = strip_tags(BBCode::convertForUriId($event['uri-id'], $event['summary']));
|
$title = strip_tags(BBCode::convertForUriId($event['uri-id'], $event['summary']));
|
||||||
if (!$title) {
|
if (!$title) {
|
||||||
[$title, $_trash] = explode("<br", BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc'])), BBCode::TWITTER_API);
|
list($title, $_trash) = explode("<br", BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc'])), BBCode::TWITTER_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
$event['author-link'] = Contact::magicLink($event['author-link']);
|
$event['author-link'] = Contact::magicLink($event['author-link']);
|
||||||
|
|
|
@ -450,9 +450,11 @@ class GServer
|
||||||
$gserver = DBA::selectFirst('gserver', [], ['nurl' => $nurl]);
|
$gserver = DBA::selectFirst('gserver', [], ['nurl' => $nurl]);
|
||||||
if (DBA::isResult($gserver)) {
|
if (DBA::isResult($gserver)) {
|
||||||
$next_update = self::getNextUpdateDate(false, $gserver['created'], $gserver['last_contact']);
|
$next_update = self::getNextUpdateDate(false, $gserver['created'], $gserver['last_contact']);
|
||||||
self::update(['url' => $url, 'failed' => true, 'blocked' => Network::isUrlBlocked($url), 'last_failure' => DateTimeFormat::utcNow(),
|
self::update(
|
||||||
|
['url' => $url, 'failed' => true, 'blocked' => Network::isUrlBlocked($url), 'last_failure' => DateTimeFormat::utcNow(),
|
||||||
'next_contact' => $next_update, 'network' => Protocol::PHANTOM, 'detection-method' => null],
|
'next_contact' => $next_update, 'network' => Protocol::PHANTOM, 'detection-method' => null],
|
||||||
['nurl' => $nurl]);
|
['nurl' => $nurl]
|
||||||
|
);
|
||||||
DI::logger()->info('Set failed status for existing server', ['url' => $url]);
|
DI::logger()->info('Set failed status for existing server', ['url' => $url]);
|
||||||
if (self::isDefunct($gserver)) {
|
if (self::isDefunct($gserver)) {
|
||||||
self::archiveContacts($gserver['id']);
|
self::archiveContacts($gserver['id']);
|
||||||
|
@ -2501,9 +2503,12 @@ class GServer
|
||||||
|
|
||||||
$last_update = date('c', time() - (60 * 60 * 24 * $requery_days));
|
$last_update = date('c', time() - (60 * 60 * 24 * $requery_days));
|
||||||
|
|
||||||
$gservers = DBA::select('gserver', ['id', 'url', 'nurl', 'network', 'poco', 'directory-type'],
|
$gservers = DBA::select(
|
||||||
|
'gserver',
|
||||||
|
['id', 'url', 'nurl', 'network', 'poco', 'directory-type'],
|
||||||
["NOT `blocked` AND NOT `failed` AND `directory-type` != ? AND `last_poco_query` < ?", GServer::DT_NONE, $last_update],
|
["NOT `blocked` AND NOT `failed` AND `directory-type` != ? AND `last_poco_query` < ?", GServer::DT_NONE, $last_update],
|
||||||
['order' => ['RAND()']]);
|
['order' => ['RAND()']]
|
||||||
|
);
|
||||||
|
|
||||||
while ($gserver = DBA::fetch($gservers)) {
|
while ($gserver = DBA::fetch($gservers)) {
|
||||||
DI::logger()->info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
DI::logger()->info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
||||||
|
|
|
@ -2329,7 +2329,7 @@ class Item
|
||||||
|
|
||||||
public static function getLanguageMessage(array $item): string
|
public static function getLanguageMessage(array $item): string
|
||||||
{
|
{
|
||||||
$iso639 = new \Matriphe\ISO639\ISO639;
|
$iso639 = new \Matriphe\ISO639\ISO639();
|
||||||
|
|
||||||
$used_languages = '';
|
$used_languages = '';
|
||||||
foreach (json_decode($item['language'], true) as $language => $reliability) {
|
foreach (json_decode($item['language'], true) as $language => $reliability) {
|
||||||
|
|
|
@ -447,7 +447,8 @@ class Post
|
||||||
$selected = Item::DISPLAY_FIELDLIST;
|
$selected = Item::DISPLAY_FIELDLIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["`visible` AND NOT `deleted`
|
["`visible` AND NOT `deleted`
|
||||||
AND NOT `author-blocked` AND NOT `owner-blocked`
|
AND NOT `author-blocked` AND NOT `owner-blocked`
|
||||||
AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked`
|
AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked`
|
||||||
|
@ -456,7 +457,8 @@ class Post
|
||||||
AND NOT EXISTS(SELECT `uri-id` FROM `post-user` WHERE `uid` = ? AND `uri-id` = " . DBA::quoteIdentifier($view) . ".`uri-id` AND `hidden`)
|
AND NOT EXISTS(SELECT `uri-id` FROM `post-user` WHERE `uid` = ? AND `uri-id` = " . DBA::quoteIdentifier($view) . ".`uri-id` AND `hidden`)
|
||||||
AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` IN (`author-id`, `owner-id`) AND (`blocked` OR `ignored` OR `is-blocked`))
|
AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` IN (`author-id`, `owner-id`) AND (`blocked` OR `ignored` OR `is-blocked`))
|
||||||
AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = ? AND `gsid` IN (`author-gsid`, `owner-gsid`, `causer-gsid`) AND `ignored`)",
|
AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = ? AND `gsid` IN (`author-gsid`, `owner-gsid`, `causer-gsid`) AND `ignored`)",
|
||||||
0, Contact::SHARING, Contact::FRIEND, 0, $uid, $uid, $uid]);
|
0, Contact::SHARING, Contact::FRIEND, 0, $uid, $uid, $uid]
|
||||||
|
);
|
||||||
|
|
||||||
$select_string = implode(', ', array_map([DBA::class, 'quoteIdentifier'], $selected));
|
$select_string = implode(', ', array_map([DBA::class, 'quoteIdentifier'], $selected));
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,13 @@ class Engagement
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = Post::selectFirst(['uri-id', 'created', 'uid', 'private', 'quote-uri-id',
|
$parent = Post::selectFirst(
|
||||||
|
['uri-id', 'created', 'uid', 'private', 'quote-uri-id',
|
||||||
'contact-contact-type', 'network', 'title', 'content-warning', 'body', 'language',
|
'contact-contact-type', 'network', 'title', 'content-warning', 'body', 'language',
|
||||||
'author-id', 'author-contact-type', 'author-nick', 'author-addr', 'author-gsid',
|
'author-id', 'author-contact-type', 'author-nick', 'author-addr', 'author-gsid',
|
||||||
'owner-id', 'owner-contact-type', 'owner-nick', 'owner-addr', 'owner-gsid'],
|
'owner-id', 'owner-contact-type', 'owner-nick', 'owner-addr', 'owner-gsid'],
|
||||||
['uri-id' => $item['parent-uri-id']]);
|
['uri-id' => $item['parent-uri-id']]
|
||||||
|
);
|
||||||
|
|
||||||
if ($parent['created'] < self::getCreationDateLimit(false)) {
|
if ($parent['created'] < self::getCreationDateLimit(false)) {
|
||||||
DI::logger()->debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
|
DI::logger()->debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
|
||||||
|
@ -314,8 +316,10 @@ class Engagement
|
||||||
|
|
||||||
private static function addResharers(string $text, int $uri_id): string
|
private static function addResharers(string $text, int $uri_id): string
|
||||||
{
|
{
|
||||||
$result = Post::selectPosts(['author-addr', 'author-nick', 'author-contact-type'],
|
$result = Post::selectPosts(
|
||||||
['thr-parent-id' => $uri_id, 'gravity' => Item::GRAVITY_ACTIVITY, 'verb' => Activity::ANNOUNCE, 'author-contact-type' => [Contact::TYPE_RELAY, Contact::TYPE_COMMUNITY]]);
|
['author-addr', 'author-nick', 'author-contact-type'],
|
||||||
|
['thr-parent-id' => $uri_id, 'gravity' => Item::GRAVITY_ACTIVITY, 'verb' => Activity::ANNOUNCE, 'author-contact-type' => [Contact::TYPE_RELAY, Contact::TYPE_COMMUNITY]]
|
||||||
|
);
|
||||||
while ($reshare = Post::fetch($result)) {
|
while ($reshare = Post::fetch($result)) {
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
|
|
||||||
|
@ -392,11 +396,11 @@ class Engagement
|
||||||
|
|
||||||
public static function escapeKeywords(string $fullTextSearch): string
|
public static function escapeKeywords(string $fullTextSearch): string
|
||||||
{
|
{
|
||||||
foreach (SELF::SHORTCUTS as $search => $replace) {
|
foreach (self::SHORTCUTS as $search => $replace) {
|
||||||
$fullTextSearch = preg_replace('~' . $search . ':(.[\w\*@\.-]+)~', $replace . ':$1', $fullTextSearch);
|
$fullTextSearch = preg_replace('~' . $search . ':(.[\w\*@\.-]+)~', $replace . ':$1', $fullTextSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (SELF::ALTERNATIVES as $search => $replace) {
|
foreach (self::ALTERNATIVES as $search => $replace) {
|
||||||
$fullTextSearch = str_replace($search, $replace, $fullTextSearch);
|
$fullTextSearch = str_replace($search, $replace, $fullTextSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,11 +305,9 @@ class Profile
|
||||||
|
|
||||||
$local_user_is_self = DI::userSession()->getMyUrl() && ($profile['url'] == DI::userSession()->getMyUrl());
|
$local_user_is_self = DI::userSession()->getMyUrl() && ($profile['url'] == DI::userSession()->getMyUrl());
|
||||||
$visitor_is_authenticated = (bool)DI::userSession()->getMyUrl();
|
$visitor_is_authenticated = (bool)DI::userSession()->getMyUrl();
|
||||||
$visitor_is_following =
|
$visitor_is_following = in_array($visitor_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND])
|
||||||
in_array($visitor_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND])
|
|
||||||
|| in_array($profile_contact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]);
|
|| in_array($profile_contact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]);
|
||||||
$visitor_is_followed =
|
$visitor_is_followed = in_array($visitor_contact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND])
|
||||||
in_array($visitor_contact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND])
|
|
||||||
|| in_array($profile_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
|
|| in_array($profile_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
|
||||||
$visitor_base_path = DI::userSession()->getMyUrl() ? preg_replace('=/profile/(.*)=ism', '', DI::userSession()->getMyUrl()) : '';
|
$visitor_base_path = DI::userSession()->getMyUrl() ? preg_replace('=/profile/(.*)=ism', '', DI::userSession()->getMyUrl()) : '';
|
||||||
|
|
||||||
|
@ -822,7 +820,7 @@ class Profile
|
||||||
$profile['profile-name'] = null;
|
$profile['profile-name'] = null;
|
||||||
$profile['is-default'] = null;
|
$profile['is-default'] = null;
|
||||||
DBA::update('profile', $profile, ['id' => $profile['id']]);
|
DBA::update('profile', $profile, ['id' => $profile['id']]);
|
||||||
} else if (!empty($profile['id'])) {
|
} elseif (!empty($profile['id'])) {
|
||||||
DBA::delete('profile', ['id' => $profile['id']]);
|
DBA::delete('profile', ['id' => $profile['id']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1496,7 +1496,7 @@ class User
|
||||||
* @param bool $block Block state (default is true)
|
* @param bool $block Block state (default is true)
|
||||||
*
|
*
|
||||||
* @return bool True, if successfully blocked
|
* @return bool True, if successfully blocked
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function block(int $uid, bool $block = true): bool
|
public static function block(int $uid, bool $block = true): bool
|
||||||
|
@ -1946,10 +1946,13 @@ class User
|
||||||
'active_users_weekly' => 0,
|
'active_users_weekly' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$userStmt = DBA::select('owner-view', ['uid', 'last-activity', 'last-item'],
|
$userStmt = DBA::select(
|
||||||
|
'owner-view',
|
||||||
|
['uid', 'last-activity', 'last-item'],
|
||||||
["`verified` AND `last-activity` > ? AND NOT `blocked`
|
["`verified` AND `last-activity` > ? AND NOT `blocked`
|
||||||
AND NOT `account_removed` AND NOT `account_expired`",
|
AND NOT `account_removed` AND NOT `account_expired`",
|
||||||
DBA::NULL_DATETIME]);
|
DBA::NULL_DATETIME]
|
||||||
|
);
|
||||||
if (!DBA::isResult($userStmt)) {
|
if (!DBA::isResult($userStmt)) {
|
||||||
return $statistics;
|
return $statistics;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,11 @@ class Objects extends BaseModule
|
||||||
|
|
||||||
$data = ['@context' => ActivityPub::CONTEXT];
|
$data = ['@context' => ActivityPub::CONTEXT];
|
||||||
$data = array_merge($data, $activity['object']);
|
$data = array_merge($data, $activity['object']);
|
||||||
} elseif (empty($this->parameters['activity']) || in_array($this->parameters['activity'],
|
} elseif (empty($this->parameters['activity']) || in_array(
|
||||||
|
$this->parameters['activity'],
|
||||||
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
|
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
|
||||||
'TentativeAccept', 'Follow', 'Add'])) {
|
'TentativeAccept', 'Follow', 'Add']
|
||||||
|
)) {
|
||||||
$data = ActivityPub\Transmitter::createCachedActivityFromItem($item['id']);
|
$data = ActivityPub\Transmitter::createCachedActivityFromItem($item['id']);
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
throw new HTTPException\NotFoundException();
|
throw new HTTPException\NotFoundException();
|
||||||
|
|
|
@ -72,7 +72,7 @@ class ListTimeline extends BaseApi
|
||||||
$items = $this->getStatusesForGroup($uid, $request);
|
$items = $this->getStatusesForGroup($uid, $request);
|
||||||
} elseif (substr($this->parameters['id'], 0, 8) == 'channel:') {
|
} elseif (substr($this->parameters['id'], 0, 8) == 'channel:') {
|
||||||
$items = $this->getStatusesForChannel($uid, $request);
|
$items = $this->getStatusesForChannel($uid, $request);
|
||||||
} else{
|
} else {
|
||||||
$items = $this->getStatusesForCircle($uid, $request);
|
$items = $this->getStatusesForCircle($uid, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -432,7 +432,7 @@ class BaseApi extends BaseModule
|
||||||
// Check for throttling (maximum posts per day, week and month)
|
// Check for throttling (maximum posts per day, week and month)
|
||||||
$throttle_day = DI::config()->get('system', 'throttle_limit_day');
|
$throttle_day = DI::config()->get('system', 'throttle_limit_day');
|
||||||
if ($throttle_day > 0) {
|
if ($throttle_day > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60);
|
||||||
|
|
||||||
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
||||||
$posts_day = Post::countThread($condition);
|
$posts_day = Post::countThread($condition);
|
||||||
|
@ -448,7 +448,7 @@ class BaseApi extends BaseModule
|
||||||
|
|
||||||
$throttle_week = DI::config()->get('system', 'throttle_limit_week');
|
$throttle_week = DI::config()->get('system', 'throttle_limit_week');
|
||||||
if ($throttle_week > 0) {
|
if ($throttle_week > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60 * 7);
|
||||||
|
|
||||||
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
||||||
$posts_week = Post::countThread($condition);
|
$posts_week = Post::countThread($condition);
|
||||||
|
@ -464,7 +464,7 @@ class BaseApi extends BaseModule
|
||||||
|
|
||||||
$throttle_month = DI::config()->get('system', 'throttle_limit_month');
|
$throttle_month = DI::config()->get('system', 'throttle_limit_month');
|
||||||
if ($throttle_month > 0) {
|
if ($throttle_month > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60 * 30);
|
||||||
|
|
||||||
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
|
||||||
$posts_month = Post::countThread($condition);
|
$posts_month = Post::countThread($condition);
|
||||||
|
|
|
@ -63,11 +63,19 @@ class BaseSearch extends BaseModule
|
||||||
$search = Network::convertToIdn($search);
|
$search = Network::convertToIdn($search);
|
||||||
|
|
||||||
if (DI::mode()->isMobile()) {
|
if (DI::mode()->isMobile()) {
|
||||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
|
$itemsPerPage = DI::pConfig()->get(
|
||||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
DI::userSession()->getLocalUserId(),
|
||||||
|
'system',
|
||||||
|
'itemspage_mobile_network',
|
||||||
|
DI::config()->get('system', 'itemspage_network_mobile')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
|
$itemsPerPage = DI::pConfig()->get(
|
||||||
DI::config()->get('system', 'itemspage_network'));
|
DI::userSession()->getLocalUserId(),
|
||||||
|
'system',
|
||||||
|
'itemspage_network',
|
||||||
|
DI::config()->get('system', 'itemspage_network')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||||
|
@ -131,7 +139,8 @@ class BaseSearch extends BaseModule
|
||||||
'$filtered' => $filtered ? DI::l10n()->tt(
|
'$filtered' => $filtered ? DI::l10n()->tt(
|
||||||
'%d result was filtered out because your node blocks the domain it is registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
|
'%d result was filtered out because your node blocks the domain it is registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
|
||||||
'%d results were filtered out because your node blocks the domain they are registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
|
'%d results were filtered out because your node blocks the domain they are registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
|
||||||
$filtered) : '',
|
$filtered
|
||||||
|
) : '',
|
||||||
'$contacts' => $entries,
|
'$contacts' => $entries,
|
||||||
'$paginate' => $pager->renderFull($results->getTotal()),
|
'$paginate' => $pager->renderFull($results->getTotal()),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -566,11 +566,11 @@ class Contact extends BaseModule
|
||||||
$alt_text = DI::l10n()->t('Mutual Friendship');
|
$alt_text = DI::l10n()->t('Mutual Friendship');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Model\Contact::FOLLOWER;
|
case Model\Contact::FOLLOWER:
|
||||||
$alt_text = DI::l10n()->t('is a fan of yours');
|
$alt_text = DI::l10n()->t('is a fan of yours');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Model\Contact::SHARING;
|
case Model\Contact::SHARING:
|
||||||
$alt_text = DI::l10n()->t('you are a fan of');
|
$alt_text = DI::l10n()->t('you are a fan of');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ class Token extends BaseApi
|
||||||
|
|
||||||
if (empty($request['client_id']) || empty($request['client_secret'])) {
|
if (empty($request['client_id']) || empty($request['client_secret'])) {
|
||||||
$this->logger->warning('Incomplete request data', ['request' => $request]);
|
$this->logger->warning('Incomplete request data', ['request' => $request]);
|
||||||
$this->logAndJsonError(401, $this->errorFactory->Unauthorized('invalid_client', $this->t('Incomplete request data')));;
|
$this->logAndJsonError(401, $this->errorFactory->Unauthorized('invalid_client', $this->t('Incomplete request data')));
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
$application = OAuth::getApplication($request['client_id'], $request['client_secret'], $request['redirect_uri']);
|
$application = OAuth::getApplication($request['client_id'], $request['client_secret'], $request['redirect_uri']);
|
||||||
|
@ -90,7 +91,7 @@ class Token extends BaseApi
|
||||||
|
|
||||||
// now check for $grant_type === 'authorization_code'
|
// now check for $grant_type === 'authorization_code'
|
||||||
// For security reasons only allow freshly created tokens
|
// For security reasons only allow freshly created tokens
|
||||||
$redirect_uri = strtok($request['redirect_uri'],'?');
|
$redirect_uri = strtok($request['redirect_uri'], '?');
|
||||||
$condition = [
|
$condition = [
|
||||||
"`redirect_uri` LIKE ? AND `id` = ? AND `code` = ? AND `created_at` > ?",
|
"`redirect_uri` LIKE ? AND `id` = ? AND `code` = ? AND `created_at` > ?",
|
||||||
$redirect_uri, $application['id'], $request['code'], DateTimeFormat::utc('now - 5 minutes')
|
$redirect_uri, $application['id'], $request['code'], DateTimeFormat::utc('now - 5 minutes')
|
||||||
|
|
|
@ -168,7 +168,7 @@ class Register extends BaseModule
|
||||||
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
|
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
|
||||||
'$tostext' => DI::l10n()->t('Terms of Service'),
|
'$tostext' => DI::l10n()->t('Terms of Service'),
|
||||||
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
|
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
|
||||||
'$privstatement'=> $this->tos->privacy_complete,
|
'$privstatement' => $this->tos->privacy_complete,
|
||||||
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
|
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
|
||||||
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
|
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
|
||||||
'$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
|
'$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
|
||||||
|
@ -344,9 +344,11 @@ class Register extends BaseModule
|
||||||
DI::baseUrl()->redirect();
|
DI::baseUrl()->redirect();
|
||||||
} else {
|
} else {
|
||||||
DI::sysmsg()->addNotice(
|
DI::sysmsg()->addNotice(
|
||||||
DI::l10n()->t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
DI::l10n()->t(
|
||||||
|
'Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
||||||
$user['email'],
|
$user['email'],
|
||||||
$result['password'])
|
$result['password']
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,12 +59,14 @@ class Index extends BaseSearch
|
||||||
// 10 requests are "free", after the 11th only a call per minute is allowed
|
// 10 requests are "free", after the 11th only a call per minute is allowed
|
||||||
|
|
||||||
$free_crawls = intval(DI::config()->get('system', 'free_crawls'));
|
$free_crawls = intval(DI::config()->get('system', 'free_crawls'));
|
||||||
if ($free_crawls == 0)
|
if ($free_crawls == 0) {
|
||||||
$free_crawls = 10;
|
$free_crawls = 10;
|
||||||
|
}
|
||||||
|
|
||||||
$crawl_permit_period = intval(DI::config()->get('system', 'crawl_permit_period'));
|
$crawl_permit_period = intval(DI::config()->get('system', 'crawl_permit_period'));
|
||||||
if ($crawl_permit_period == 0)
|
if ($crawl_permit_period == 0) {
|
||||||
$crawl_permit_period = 10;
|
$crawl_permit_period = 10;
|
||||||
|
}
|
||||||
|
|
||||||
$remote = $this->remoteAddress;
|
$remote = $this->remoteAddress;
|
||||||
$result = DI::cache()->get('remote_search:' . $remote);
|
$result = DI::cache()->get('remote_search:' . $remote);
|
||||||
|
@ -146,11 +148,19 @@ class Index extends BaseSearch
|
||||||
// No items will be shown if the member has a blocked profile wall.
|
// No items will be shown if the member has a blocked profile wall.
|
||||||
|
|
||||||
if (DI::mode()->isMobile()) {
|
if (DI::mode()->isMobile()) {
|
||||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
|
$itemsPerPage = DI::pConfig()->get(
|
||||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
DI::userSession()->getLocalUserId(),
|
||||||
|
'system',
|
||||||
|
'itemspage_mobile_network',
|
||||||
|
DI::config()->get('system', 'itemspage_network_mobile')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
|
$itemsPerPage = DI::pConfig()->get(
|
||||||
DI::config()->get('system', 'itemspage_network'));
|
DI::userSession()->getLocalUserId(),
|
||||||
|
'system',
|
||||||
|
'itemspage_network',
|
||||||
|
DI::config()->get('system', 'itemspage_network')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_uriid = isset($_GET['last_uriid']) ? intval($_GET['last_uriid']) : 0;
|
$last_uriid = isset($_GET['last_uriid']) ? intval($_GET['last_uriid']) : 0;
|
||||||
|
|
|
@ -1671,7 +1671,9 @@ class Probe
|
||||||
$parts = array_filter(explode('/', $path), 'strlen');
|
$parts = array_filter(explode('/', $path), 'strlen');
|
||||||
$absolutes = [];
|
$absolutes = [];
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if ('.' == $part) continue;
|
if ('.' == $part) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ('..' == $part) {
|
if ('..' == $part) {
|
||||||
array_pop($absolutes);
|
array_pop($absolutes);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -322,8 +322,10 @@ class ClientToServer
|
||||||
if (!empty($requester_id)) {
|
if (!empty($requester_id)) {
|
||||||
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
|
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
|
||||||
if (count($permissionSets) > 0) {
|
if (count($permissionSets) > 0) {
|
||||||
$condition = ['psid' => array_merge($permissionSets->column('id'),
|
$condition = ['psid' => array_merge(
|
||||||
[DI::permissionSet()->selectPublicForUser($owner['uid'])])];
|
$permissionSets->column('id'),
|
||||||
|
[DI::permissionSet()->selectPublicForUser($owner['uid'])]
|
||||||
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ class Delivery
|
||||||
|
|
||||||
// Resubscribe to relay server upon client error
|
// Resubscribe to relay server upon client error
|
||||||
if (!$serverfail && ($response->getReturnCode() >= 400) && ($response->getReturnCode() <= 499)) {
|
if (!$serverfail && ($response->getReturnCode() >= 400) && ($response->getReturnCode() <= 499)) {
|
||||||
$actor = self:: fetchActorForRelayInbox($inbox);
|
$actor = self::fetchActorForRelayInbox($inbox);
|
||||||
if (!empty($actor)) {
|
if (!empty($actor)) {
|
||||||
$drop = !ActivityPub\Transmitter::sendRelayFollow($actor);
|
$drop = !ActivityPub\Transmitter::sendRelayFollow($actor);
|
||||||
DI::logger()->notice('Resubscribed to relay', ['url' => $actor, 'success' => !$drop]);
|
DI::logger()->notice('Resubscribed to relay', ['url' => $actor, 'success' => !$drop]);
|
||||||
|
|
|
@ -1194,8 +1194,10 @@ class Processor
|
||||||
|
|
||||||
if ((DI::pConfig()->get($receiver, 'system', 'accept_only_sharer') != Item::COMPLETION_LIKE)
|
if ((DI::pConfig()->get($receiver, 'system', 'accept_only_sharer') != Item::COMPLETION_LIKE)
|
||||||
&& in_array($activity['thread-children-type'] ?? '', Receiver::ACTIVITY_TYPES)) {
|
&& in_array($activity['thread-children-type'] ?? '', Receiver::ACTIVITY_TYPES)) {
|
||||||
DI::logger()->info('Top level post from thread completion from a non sharer had been initiated via an activity, ignoring',
|
DI::logger()->info(
|
||||||
['type' => $activity['thread-children-type'], 'user' => $item['uid'], 'causer' => $item['causer-link'], 'author' => $activity['author'], 'url' => $item['uri']]);
|
'Top level post from thread completion from a non sharer had been initiated via an activity, ignoring',
|
||||||
|
['type' => $activity['thread-children-type'], 'user' => $item['uid'], 'causer' => $item['causer-link'], 'author' => $activity['author'], 'url' => $item['uri']]
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2053,7 +2055,7 @@ class Processor
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$iso639 = new \Matriphe\ISO639\ISO639;
|
$iso639 = new \Matriphe\ISO639\ISO639();
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($languages as $language) {
|
foreach ($languages as $language) {
|
||||||
|
|
|
@ -1403,7 +1403,8 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'Delete') {
|
if ($type == 'Delete') {
|
||||||
$data['id'] = Item::newURI($item['guid']) . '/' . $type;;
|
$data['id'] = Item::newURI($item['guid']) . '/' . $type;
|
||||||
|
;
|
||||||
} elseif (($item['gravity'] == Item::GRAVITY_ACTIVITY) && ($type != 'Undo')) {
|
} elseif (($item['gravity'] == Item::GRAVITY_ACTIVITY) && ($type != 'Undo')) {
|
||||||
$data['id'] = $item['uri'];
|
$data['id'] = $item['uri'];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,6 @@ use GuzzleHttp\Psr7\Uri;
|
||||||
*/
|
*/
|
||||||
class DFRN
|
class DFRN
|
||||||
{
|
{
|
||||||
|
|
||||||
const TOP_LEVEL = 0; // Top level posting
|
const TOP_LEVEL = 0; // Top level posting
|
||||||
const REPLY = 1; // Regular reply that is stored locally
|
const REPLY = 1; // Regular reply that is stored locally
|
||||||
const REPLY_RC = 2; // Reply that will be relayed
|
const REPLY_RC = 2; // Reply that will be relayed
|
||||||
|
@ -489,9 +488,11 @@ class DFRN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show contact details when we are allowed to
|
// Only show contact details when we are allowed to
|
||||||
$profile = DBA::selectFirst('owner-view',
|
$profile = DBA::selectFirst(
|
||||||
|
'owner-view',
|
||||||
['about', 'name', 'homepage', 'nickname', 'timezone', 'locality', 'region', 'country-name', 'pub_keywords', 'xmpp', 'dob'],
|
['about', 'name', 'homepage', 'nickname', 'timezone', 'locality', 'region', 'country-name', 'pub_keywords', 'xmpp', 'dob'],
|
||||||
['uid' => $owner['uid'], 'hidewall' => false]);
|
['uid' => $owner['uid'], 'hidewall' => false]
|
||||||
|
);
|
||||||
if (DBA::isResult($profile)) {
|
if (DBA::isResult($profile)) {
|
||||||
XML::addElement($doc, $author, 'poco:displayName', $profile['name']);
|
XML::addElement($doc, $author, 'poco:displayName', $profile['name']);
|
||||||
XML::addElement($doc, $author, 'poco:updated', $namdate);
|
XML::addElement($doc, $author, 'poco:updated', $namdate);
|
||||||
|
@ -1662,11 +1663,16 @@ class DFRN
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
foreach ($link->attributes as $attributes) {
|
foreach ($link->attributes as $attributes) {
|
||||||
switch ($attributes->name) {
|
switch ($attributes->name) {
|
||||||
case 'href' : $href = $attributes->textContent; break;
|
case 'href': $href = $attributes->textContent;
|
||||||
case 'rel' : $rel = $attributes->textContent; break;
|
break;
|
||||||
case 'type' : $type = $attributes->textContent; break;
|
case 'rel': $rel = $attributes->textContent;
|
||||||
case 'length': $length = $attributes->textContent; break;
|
break;
|
||||||
case 'title' : $title = $attributes->textContent; break;
|
case 'type': $type = $attributes->textContent;
|
||||||
|
break;
|
||||||
|
case 'length': $length = $attributes->textContent;
|
||||||
|
break;
|
||||||
|
case 'title': $title = $attributes->textContent;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($rel != '') && ($href != '')) {
|
if (($rel != '') && ($href != '')) {
|
||||||
|
@ -1745,7 +1751,8 @@ class DFRN
|
||||||
|
|
||||||
$item['edited'] = XML::getFirstNodeValue($xpath, 'atom:updated/text()', $entry);
|
$item['edited'] = XML::getFirstNodeValue($xpath, 'atom:updated/text()', $entry);
|
||||||
|
|
||||||
$current = Post::selectFirst(['id', 'uid', 'edited', 'body'],
|
$current = Post::selectFirst(
|
||||||
|
['id', 'uid', 'edited', 'body'],
|
||||||
['uri' => $item['uri'], 'uid' => $importer['importer_uid']]
|
['uri' => $item['uri'], 'uid' => $importer['importer_uid']]
|
||||||
);
|
);
|
||||||
// Is there an existing item?
|
// Is there an existing item?
|
||||||
|
|
|
@ -185,7 +185,9 @@ class Delivery
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't deliver our items to blocked, archived or pending contacts, and not to ourselves either
|
// We don't deliver our items to blocked, archived or pending contacts, and not to ourselves either
|
||||||
$contact = DBA::selectFirst('contact', [],
|
$contact = DBA::selectFirst(
|
||||||
|
'contact',
|
||||||
|
[],
|
||||||
['id' => $contact_id, 'archive' => false, 'blocked' => false, 'pending' => false, 'self' => false]
|
['id' => $contact_id, 'archive' => false, 'blocked' => false, 'pending' => false, 'self' => false]
|
||||||
);
|
);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
|
@ -533,10 +535,10 @@ class Delivery
|
||||||
|
|
||||||
if (($contact['rel'] == Contact::FRIEND) && !$contact['blocked']) {
|
if (($contact['rel'] == Contact::FRIEND) && !$contact['blocked']) {
|
||||||
if ($reply_to) {
|
if ($reply_to) {
|
||||||
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $reply_to . '>' . "\n";
|
$headers = 'From: ' . Email::encodeHeader($local_user['username'], 'UTF-8') . ' <' . $reply_to . '>' . "\n";
|
||||||
$headers .= 'Sender: ' . $local_user['email'] . "\n";
|
$headers .= 'Sender: ' . $local_user['email'] . "\n";
|
||||||
} else {
|
} else {
|
||||||
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
|
$headers = 'From: ' . Email::encodeHeader($local_user['username'], 'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHost());
|
$sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHost());
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Friendica\Network\HTTPException;
|
||||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Delivery;
|
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Map;
|
use Friendica\Util\Map;
|
||||||
|
@ -648,8 +647,9 @@ class Diaspora
|
||||||
|
|
||||||
// All retractions are handled identically from now on.
|
// All retractions are handled identically from now on.
|
||||||
// In the new version there will only be "retraction".
|
// In the new version there will only be "retraction".
|
||||||
if (in_array($type, ['signed_retraction', 'relayable_retraction']))
|
if (in_array($type, ['signed_retraction', 'relayable_retraction'])) {
|
||||||
$type = 'retraction';
|
$type = 'retraction';
|
||||||
|
}
|
||||||
|
|
||||||
if ($type == 'request') {
|
if ($type == 'request') {
|
||||||
$type = 'contact';
|
$type = 'contact';
|
||||||
|
@ -3366,8 +3366,9 @@ class Diaspora
|
||||||
|
|
||||||
$location = [];
|
$location = [];
|
||||||
|
|
||||||
if ($item['location'] != '')
|
if ($item['location'] != '') {
|
||||||
$location['address'] = $item['location'];
|
$location['address'] = $item['location'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($item['coord'] != '') {
|
if ($item['coord'] != '') {
|
||||||
$coord = explode(' ', $item['coord']);
|
$coord = explode(' ', $item['coord']);
|
||||||
|
@ -3912,7 +3913,7 @@ class Diaspora
|
||||||
$data['birthday'] = '';
|
$data['birthday'] = '';
|
||||||
|
|
||||||
if ($profile['dob'] && ($profile['dob'] > '0000-00-00')) {
|
if ($profile['dob'] && ($profile['dob'] > '0000-00-00')) {
|
||||||
[$year, $month, $day] = sscanf($profile['dob'], '%4d-%2d-%2d');
|
list($year, $month, $day) = sscanf($profile['dob'], '%4d-%2d-%2d');
|
||||||
if ($year < 1004) {
|
if ($year < 1004) {
|
||||||
$year = 1004;
|
$year = 1004;
|
||||||
}
|
}
|
||||||
|
@ -4003,7 +4004,8 @@ class Diaspora
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE])) {
|
if (!in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE])) {
|
||||||
DI::logger()->warning('Item is neither a like nor a dislike', ['uid' => $uid, 'item[verb]' => $item['verb']]);;
|
DI::logger()->warning('Item is neither a like nor a dislike', ['uid' => $uid, 'item[verb]' => $item['verb']]);
|
||||||
|
;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,8 +221,8 @@ class Email
|
||||||
|
|
||||||
// DECODE DATA
|
// DECODE DATA
|
||||||
$data = ($partno)
|
$data = ($partno)
|
||||||
? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
|
? @imap_fetchbody($mbox, $uid, $partno, FT_UID | FT_PEEK)
|
||||||
: @imap_body($mbox, $uid, FT_UID|FT_PEEK);
|
: @imap_body($mbox, $uid, FT_UID | FT_PEEK);
|
||||||
|
|
||||||
// Any part may be encoded, even plain text messages, so check everything.
|
// Any part may be encoded, even plain text messages, so check everything.
|
||||||
if ($p->encoding == 4) {
|
if ($p->encoding == 4) {
|
||||||
|
@ -261,7 +261,7 @@ class Email
|
||||||
if ($p->type == 0 && $data) {
|
if ($p->type == 0 && $data) {
|
||||||
// Messages may be split in different parts because of inline attachments,
|
// Messages may be split in different parts because of inline attachments,
|
||||||
// so append parts together with blank row.
|
// so append parts together with blank row.
|
||||||
if (strtolower($p->subtype)==$subtype) {
|
if (strtolower($p->subtype) == $subtype) {
|
||||||
$data = iconv($params['charset'], 'UTF-8//IGNORE', $data);
|
$data = iconv($params['charset'], 'UTF-8//IGNORE', $data);
|
||||||
return (trim($data) ."\n\n");
|
return (trim($data) ."\n\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -285,7 +285,7 @@ class Email
|
||||||
if (isset($p->parts) && $p->parts) {
|
if (isset($p->parts) && $p->parts) {
|
||||||
$x = "";
|
$x = "";
|
||||||
foreach ($p->parts as $partno0 => $p2) {
|
foreach ($p->parts as $partno0 => $p2) {
|
||||||
$x .= self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
|
$x .= self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0 + 1), $subtype); // 1.2, 1.2.1, etc.
|
||||||
}
|
}
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ class Email
|
||||||
$out_str = $in_str;
|
$out_str = $in_str;
|
||||||
$need_to_convert = false;
|
$need_to_convert = false;
|
||||||
|
|
||||||
for ($x = 0; $x < strlen($in_str); $x ++) {
|
for ($x = 0; $x < strlen($in_str); $x++) {
|
||||||
if ((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) {
|
if ((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) {
|
||||||
$need_to_convert = true;
|
$need_to_convert = true;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ class Email
|
||||||
foreach ($arrbody as $i => $line) {
|
foreach ($arrbody as $i => $line) {
|
||||||
$currquotelevel = 0;
|
$currquotelevel = 0;
|
||||||
$currline = $line;
|
$currline = $line;
|
||||||
while ((strlen($currline)>0) && ((substr($currline, 0, 1) == '>')
|
while ((strlen($currline) > 0) && ((substr($currline, 0, 1) == '>')
|
||||||
|| (substr($currline, 0, 1) == ' '))) {
|
|| (substr($currline, 0, 1) == ' '))) {
|
||||||
if (substr($currline, 0, 1) == '>') {
|
if (substr($currline, 0, 1) == '>') {
|
||||||
$currquotelevel++;
|
$currquotelevel++;
|
||||||
|
@ -628,7 +628,7 @@ class Email
|
||||||
|
|
||||||
$quotelevel = 0;
|
$quotelevel = 0;
|
||||||
$nextline = trim($arrbody[$i + 1] ?? '');
|
$nextline = trim($arrbody[$i + 1] ?? '');
|
||||||
while ((strlen($nextline)>0) && ((substr($nextline, 0, 1) == '>')
|
while ((strlen($nextline) > 0) && ((substr($nextline, 0, 1) == '>')
|
||||||
|| (substr($nextline, 0, 1) == ' '))) {
|
|| (substr($nextline, 0, 1) == ' '))) {
|
||||||
if (substr($nextline, 0, 1) == '>') {
|
if (substr($nextline, 0, 1) == '>') {
|
||||||
$quotelevel++;
|
$quotelevel++;
|
||||||
|
@ -642,7 +642,7 @@ class Email
|
||||||
$lines[$lineno] .= ' ';
|
$lines[$lineno] .= ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((strlen($line)>0) && ((substr($line, 0, 1) == '>')
|
while ((strlen($line) > 0) && ((substr($line, 0, 1) == '>')
|
||||||
|| (substr($line, 0, 1) == ' '))) {
|
|| (substr($line, 0, 1) == ' '))) {
|
||||||
|
|
||||||
$line = ltrim(substr($line, 1));
|
$line = ltrim(substr($line, 1));
|
||||||
|
@ -670,10 +670,11 @@ class Email
|
||||||
$quotelevel = 0;
|
$quotelevel = 0;
|
||||||
$quoteline = $arrbody[$i];
|
$quoteline = $arrbody[$i];
|
||||||
|
|
||||||
while ((strlen($quoteline)>0) and ((substr($quoteline, 0, 1) == '>')
|
while ((strlen($quoteline) > 0) and ((substr($quoteline, 0, 1) == '>')
|
||||||
|| (substr($quoteline, 0, 1) == ' '))) {
|
|| (substr($quoteline, 0, 1) == ' '))) {
|
||||||
if (substr($quoteline, 0, 1) == '>')
|
if (substr($quoteline, 0, 1) == '>') {
|
||||||
$quotelevel++;
|
$quotelevel++;
|
||||||
|
}
|
||||||
|
|
||||||
$quoteline = ltrim(substr($quoteline, 1));
|
$quoteline = ltrim(substr($quoteline, 1));
|
||||||
}
|
}
|
||||||
|
@ -773,12 +774,13 @@ class Email
|
||||||
foreach ($quotes as $index => $quote) {
|
foreach ($quotes as $index => $quote) {
|
||||||
$quotelevel += $quote;
|
$quotelevel += $quote;
|
||||||
|
|
||||||
if (($quotelevel == 0) and ($quotestart == 0))
|
if (($quotelevel == 0) and ($quotestart == 0)) {
|
||||||
$quotestart = $index;
|
$quotestart = $index;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($quotestart != 0) {
|
if ($quotestart != 0) {
|
||||||
$message = trim(substr($message, 0, $quotestart))."\n[spoiler]".substr($message, $quotestart+7, -8) . '[/spoiler]';
|
$message = trim(substr($message, 0, $quotestart))."\n[spoiler]".substr($message, $quotestart + 7, -8) . '[/spoiler]';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
|
|
|
@ -376,8 +376,11 @@ class Relay
|
||||||
*/
|
*/
|
||||||
public static function getList(array $fields = []): array
|
public static function getList(array $fields = []): array
|
||||||
{
|
{
|
||||||
return DBA::selectToArray('apcontact', $fields,
|
return DBA::selectToArray(
|
||||||
["`type` IN (?, ?) AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)", 'Application', 'Service', 0, Contact::FRIEND]);
|
'apcontact',
|
||||||
|
$fields,
|
||||||
|
["`type` IN (?, ?) AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)", 'Application', 'Service', 0, Contact::FRIEND]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,7 +103,7 @@ class BasicAuth
|
||||||
*
|
*
|
||||||
* @return integer User ID
|
* @return integer User ID
|
||||||
*/
|
*/
|
||||||
private static function getUserIdByAuth(bool $do_login = true):int
|
private static function getUserIdByAuth(bool $do_login = true): int
|
||||||
{
|
{
|
||||||
self::$current_user_id = 0;
|
self::$current_user_id = 0;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class DateTimeFormat
|
||||||
const JSON = 'Y-m-d\TH:i:s.v\Z';
|
const JSON = 'Y-m-d\TH:i:s.v\Z';
|
||||||
const API = 'D M d H:i:s +0000 Y';
|
const API = 'D M d H:i:s +0000 Y';
|
||||||
|
|
||||||
static $localTimezone = 'UTC';
|
public static $localTimezone = 'UTC';
|
||||||
|
|
||||||
public static function setLocalTimeZone(string $timezone)
|
public static function setLocalTimeZone(string $timezone)
|
||||||
{
|
{
|
||||||
|
|
|
@ -387,7 +387,7 @@ class HTTPSignature
|
||||||
* @param int $gsid Server ID
|
* @param int $gsid Server ID
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
static public function setInboxStatus(string $url, bool $success, bool $shared = false, int $gsid = null)
|
public static function setInboxStatus(string $url, bool $success, bool $shared = false, int $gsid = null)
|
||||||
{
|
{
|
||||||
$now = DateTimeFormat::utcNow();
|
$now = DateTimeFormat::utcNow();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class JsonLD
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch (parse_url($url, PHP_URL_PATH)) {
|
switch (parse_url($url, PHP_URL_PATH)) {
|
||||||
case '/schemas/litepub-0.1.jsonld';
|
case '/schemas/litepub-0.1.jsonld':
|
||||||
$url = DI::basePath() . '/static/litepub-0.1.jsonld';
|
$url = DI::basePath() . '/static/litepub-0.1.jsonld';
|
||||||
break;
|
break;
|
||||||
case '/apschema/v1.2':
|
case '/apschema/v1.2':
|
||||||
|
@ -117,7 +117,7 @@ class JsonLD
|
||||||
$jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
$jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$normalized = jsonld_normalize($jsonobj, array('algorithm' => 'URDNA2015', 'format' => 'application/nquads'));
|
$normalized = jsonld_normalize($jsonobj, ['algorithm' => 'URDNA2015', 'format' => 'application/nquads']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$normalized = false;
|
$normalized = false;
|
||||||
$messages = [];
|
$messages = [];
|
||||||
|
|
|
@ -20,7 +20,6 @@ use Psr\Http\Message\UriInterface;
|
||||||
|
|
||||||
class Network
|
class Network
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return raw post data from a post request
|
* Return raw post data from a post request
|
||||||
*
|
*
|
||||||
|
|
|
@ -115,7 +115,9 @@ class ParseUrl
|
||||||
|
|
||||||
$urlHash = hash('sha256', $url);
|
$urlHash = hash('sha256', $url);
|
||||||
|
|
||||||
$parsed_url = DBA::selectFirst('parsed_url', ['content'],
|
$parsed_url = DBA::selectFirst(
|
||||||
|
'parsed_url',
|
||||||
|
['content'],
|
||||||
['url_hash' => $urlHash, 'oembed' => false]
|
['url_hash' => $urlHash, 'oembed' => false]
|
||||||
);
|
);
|
||||||
if (!empty($parsed_url['content'])) {
|
if (!empty($parsed_url['content'])) {
|
||||||
|
@ -259,7 +261,8 @@ class ParseUrl
|
||||||
if (isset($mediaType->parameters['charset'])) {
|
if (isset($mediaType->parameters['charset'])) {
|
||||||
$charset = $mediaType->parameters['charset'];
|
$charset = $mediaType->parameters['charset'];
|
||||||
}
|
}
|
||||||
} catch(\InvalidArgumentException $e) {}
|
} catch(\InvalidArgumentException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
$siteinfo['charset'] = $charset;
|
$siteinfo['charset'] = $charset;
|
||||||
|
|
||||||
|
@ -510,7 +513,7 @@ class ParseUrl
|
||||||
* @param array $siteinfo
|
* @param array $siteinfo
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private static function checkMedia(string $page_url, array $siteinfo) : array
|
private static function checkMedia(string $page_url, array $siteinfo): array
|
||||||
{
|
{
|
||||||
if (!empty($siteinfo['images'])) {
|
if (!empty($siteinfo['images'])) {
|
||||||
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
||||||
|
@ -810,7 +813,7 @@ class ParseUrl
|
||||||
case 'Person':
|
case 'Person':
|
||||||
case 'Patient':
|
case 'Patient':
|
||||||
case 'PerformingGroup':
|
case 'PerformingGroup':
|
||||||
case 'DanceGroup';
|
case 'DanceGroup':
|
||||||
case 'MusicGroup':
|
case 'MusicGroup':
|
||||||
case 'TheaterGroup':
|
case 'TheaterGroup':
|
||||||
return self::parseJsonLdWebPerson($siteinfo, $jsonld);
|
return self::parseJsonLdWebPerson($siteinfo, $jsonld);
|
||||||
|
|
|
@ -37,7 +37,8 @@ class Proxy
|
||||||
/**
|
/**
|
||||||
* Private constructor
|
* Private constructor
|
||||||
*/
|
*/
|
||||||
private function __construct () {
|
private function __construct()
|
||||||
|
{
|
||||||
// No instances from utilities classes
|
// No instances from utilities classes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -448,13 +448,13 @@ class Strings
|
||||||
|
|
||||||
if ($start < 0) {
|
if ($start < 0) {
|
||||||
$start = max(0, $string_length + $start);
|
$start = max(0, $string_length + $start);
|
||||||
} else if ($start > $string_length) {
|
} elseif ($start > $string_length) {
|
||||||
$start = $string_length;
|
$start = $string_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length < 0) {
|
if ($length < 0) {
|
||||||
$length = max(0, $string_length - $start + $length);
|
$length = max(0, $string_length - $start + $length);
|
||||||
} else if ($length > $string_length) {
|
} elseif ($length > $string_length) {
|
||||||
$length = $string_length;
|
$length = $string_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,8 +544,10 @@ class Strings
|
||||||
switch ($last) {
|
switch ($last) {
|
||||||
case 'g':
|
case 'g':
|
||||||
$shorthand *= 1024;
|
$shorthand *= 1024;
|
||||||
|
// no break
|
||||||
case 'm':
|
case 'm':
|
||||||
$shorthand *= 1024;
|
$shorthand *= 1024;
|
||||||
|
// no break
|
||||||
case 'k':
|
case 'k':
|
||||||
$shorthand *= 1024;
|
$shorthand *= 1024;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,13 +331,13 @@ class XML
|
||||||
// See tag status and do the needed.
|
// See tag status and do the needed.
|
||||||
if ($namespaces && strpos($tag, ':')) {
|
if ($namespaces && strpos($tag, ':')) {
|
||||||
$namespc = substr($tag, 0, strrpos($tag, ':'));
|
$namespc = substr($tag, 0, strrpos($tag, ':'));
|
||||||
$tag = strtolower(substr($tag, strlen($namespc)+1));
|
$tag = strtolower(substr($tag, strlen($namespc) + 1));
|
||||||
$result['@namespace'] = $namespc;
|
$result['@namespace'] = $namespc;
|
||||||
}
|
}
|
||||||
$tag = strtolower($tag);
|
$tag = strtolower($tag);
|
||||||
|
|
||||||
if ($type == 'open') { // The starting of the tag '<tag>'
|
if ($type == 'open') { // The starting of the tag '<tag>'
|
||||||
$parent[$level-1] = &$current;
|
$parent[$level - 1] = &$current;
|
||||||
if (!is_array($current) || (!in_array($tag, array_keys($current)))) { // Insert New tag
|
if (!is_array($current) || (!in_array($tag, array_keys($current)))) { // Insert New tag
|
||||||
$current[$tag] = $result;
|
$current[$tag] = $result;
|
||||||
if ($attributes_data) {
|
if ($attributes_data) {
|
||||||
|
@ -360,7 +360,7 @@ class XML
|
||||||
unset($current[$tag.'_attr']);
|
unset($current[$tag.'_attr']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$last_item_index = $repeated_tag_index[$tag . '_' . $level]-1;
|
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
|
||||||
$current = &$current[$tag][$last_item_index];
|
$current = &$current[$tag][$last_item_index];
|
||||||
}
|
}
|
||||||
} elseif ($type == 'complete') { // Tags that ends in 1 line '<tag />'
|
} elseif ($type == 'complete') { // Tags that ends in 1 line '<tag />'
|
||||||
|
@ -399,7 +399,7 @@ class XML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($type == 'close') { // End of tag '</tag>'
|
} elseif ($type == 'close') { // End of tag '</tag>'
|
||||||
$current = &$parent[$level-1];
|
$current = &$parent[$level - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\DI;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
|
|
||||||
class APDelivery
|
class APDelivery
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,7 +47,8 @@ class Directory
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function updateAll() {
|
private static function updateAll()
|
||||||
|
{
|
||||||
$users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
|
$users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
|
||||||
while ($user = DBA::fetch($users)) {
|
while ($user = DBA::fetch($users)) {
|
||||||
Worker::add(Worker::PRIORITY_LOW, 'Directory', $user['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'Directory', $user['url']);
|
||||||
|
|
|
@ -47,16 +47,23 @@ class Expire
|
||||||
$r = DBA::select('user', ['uid', 'username'], ["`expire` != ?", 0]);
|
$r = DBA::select('user', ['uid', 'username'], ["`expire` != ?", 0]);
|
||||||
while ($row = DBA::fetch($r)) {
|
while ($row = DBA::fetch($r)) {
|
||||||
DI::logger()->info('Calling expiry', ['user' => $row['uid'], 'username' => $row['username']]);
|
DI::logger()->info('Calling expiry', ['user' => $row['uid'], 'username' => $row['username']]);
|
||||||
Worker::add(['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
Worker::add(
|
||||||
'Expire', (int)$row['uid']);
|
['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
||||||
|
'Expire',
|
||||||
|
(int)$row['uid']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
DBA::close($r);
|
DBA::close($r);
|
||||||
|
|
||||||
DI::logger()->notice('calling hooks');
|
DI::logger()->notice('calling hooks');
|
||||||
foreach (Hook::getByName('expire') as $hook) {
|
foreach (Hook::getByName('expire') as $hook) {
|
||||||
DI::logger()->info('Calling expire', ['hook' => $hook[1]]);
|
DI::logger()->info('Calling expire', ['hook' => $hook[1]]);
|
||||||
Worker::add(['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
Worker::add(
|
||||||
'Expire', 'hook', $hook[1]);
|
['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
||||||
|
'Expire',
|
||||||
|
'hook',
|
||||||
|
$hook[1]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::logger()->notice('calling hooks done');
|
DI::logger()->notice('calling hooks done');
|
||||||
|
|
|
@ -70,8 +70,16 @@ class Notifier
|
||||||
foreach ($inboxes as $inbox => $receivers) {
|
foreach ($inboxes as $inbox => $receivers) {
|
||||||
$ap_contacts = array_merge($ap_contacts, $receivers);
|
$ap_contacts = array_merge($ap_contacts, $receivers);
|
||||||
DI::logger()->info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]);
|
DI::logger()->info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]);
|
||||||
Worker::add(['priority' => Worker::PRIORITY_HIGH, 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
Worker::add(
|
||||||
'APDelivery', $cmd, $target_id, $inbox, $uid, $receivers, $post_uriid);
|
['priority' => Worker::PRIORITY_HIGH, 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
||||||
|
'APDelivery',
|
||||||
|
$cmd,
|
||||||
|
$target_id,
|
||||||
|
$inbox,
|
||||||
|
$uid,
|
||||||
|
$receivers,
|
||||||
|
$post_uriid
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} elseif ($cmd == Delivery::SUGGESTION) {
|
} elseif ($cmd == Delivery::SUGGESTION) {
|
||||||
$suggest = DI::fsuggest()->selectOneById($target_id);
|
$suggest = DI::fsuggest()->selectOneById($target_id);
|
||||||
|
@ -343,9 +351,12 @@ class Notifier
|
||||||
if ($diaspora_delivery && !$unlisted) {
|
if ($diaspora_delivery && !$unlisted) {
|
||||||
$batch_delivery = true;
|
$batch_delivery = true;
|
||||||
|
|
||||||
$participants = DBA::selectToArray('contact', ['batch', 'network', 'protocol', 'baseurl', 'gsid', 'id', 'url', 'name'],
|
$participants = DBA::selectToArray(
|
||||||
|
'contact',
|
||||||
|
['batch', 'network', 'protocol', 'baseurl', 'gsid', 'id', 'url', 'name'],
|
||||||
["`network` = ? AND `batch` != '' AND `uid` = ? AND `rel` != ? AND NOT `blocked` AND NOT `pending` AND NOT `archive`", Protocol::DIASPORA, $owner['uid'], Contact::SHARING],
|
["`network` = ? AND `batch` != '' AND `uid` = ? AND `rel` != ? AND NOT `blocked` AND NOT `pending` AND NOT `archive`", Protocol::DIASPORA, $owner['uid'], Contact::SHARING],
|
||||||
['group_by' => ['batch', 'network', 'protocol']]);
|
['group_by' => ['batch', 'network', 'protocol']]
|
||||||
|
);
|
||||||
|
|
||||||
// Fetch the participation list
|
// Fetch the participation list
|
||||||
// The function will ensure that there are no duplicates
|
// The function will ensure that there are no duplicates
|
||||||
|
@ -617,8 +628,15 @@ class Notifier
|
||||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($self_user_id);
|
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($self_user_id);
|
||||||
foreach ($inboxes as $inbox => $receivers) {
|
foreach ($inboxes as $inbox => $receivers) {
|
||||||
DI::logger()->info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]);
|
DI::logger()->info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]);
|
||||||
Worker::add(['priority' => Worker::PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
|
Worker::add(
|
||||||
'APDelivery', Delivery::REMOVAL, 0, $inbox, $self_user_id, $receivers);
|
['priority' => Worker::PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
|
||||||
|
'APDelivery',
|
||||||
|
Delivery::REMOVAL,
|
||||||
|
0,
|
||||||
|
$inbox,
|
||||||
|
$self_user_id,
|
||||||
|
$receivers
|
||||||
|
);
|
||||||
Worker::coolDown();
|
Worker::coolDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,8 +781,16 @@ class Notifier
|
||||||
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, $receivers);
|
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, $receivers);
|
||||||
Worker::add([Worker::PRIORITY_HIGH, 'dont_fork' => true], 'APDelivery', '', 0, $inbox, 0);
|
Worker::add([Worker::PRIORITY_HIGH, 'dont_fork' => true], 'APDelivery', '', 0, $inbox, 0);
|
||||||
} else {
|
} else {
|
||||||
if (Worker::add(['priority' => $priority, 'created' => $created, 'dont_fork' => true],
|
if (Worker::add(
|
||||||
'APDelivery', $cmd, $target_item['id'], $inbox, $uid, $receivers, $target_item['uri-id'])) {
|
['priority' => $priority, 'created' => $created, 'dont_fork' => true],
|
||||||
|
'APDelivery',
|
||||||
|
$cmd,
|
||||||
|
$target_item['id'],
|
||||||
|
$inbox,
|
||||||
|
$uid,
|
||||||
|
$receivers,
|
||||||
|
$target_item['uri-id']
|
||||||
|
)) {
|
||||||
$delivery_queue_count++;
|
$delivery_queue_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,11 +285,12 @@ class OnePoll
|
||||||
DI::logger()->info('Mail: Seen before ' . $msg_uid . ' for ' . $mailconf['user'] . ' UID: ' . $importer_uid . ' URI: ' . $datarray['uri']);
|
DI::logger()->info('Mail: Seen before ' . $msg_uid . ' for ' . $mailconf['user'] . ' UID: ' . $importer_uid . ' URI: ' . $datarray['uri']);
|
||||||
|
|
||||||
// Only delete when mails aren't automatically moved or deleted
|
// Only delete when mails aren't automatically moved or deleted
|
||||||
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
|
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3)) {
|
||||||
if ($meta->deleted && ! $item['deleted']) {
|
if ($meta->deleted && ! $item['deleted']) {
|
||||||
$fields = ['deleted' => true, 'changed' => $updated];
|
$fields = ['deleted' => true, 'changed' => $updated];
|
||||||
Item::update($fields, ['id' => $item['id']]);
|
Item::update($fields, ['id' => $item['id']]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ($mailconf['action']) {
|
switch ($mailconf['action']) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -327,8 +328,8 @@ class OnePoll
|
||||||
if ($raw_refs) {
|
if ($raw_refs) {
|
||||||
$refs_arr = explode(' ', $raw_refs);
|
$refs_arr = explode(' ', $raw_refs);
|
||||||
if (count($refs_arr)) {
|
if (count($refs_arr)) {
|
||||||
for ($x = 0; $x < count($refs_arr); $x ++) {
|
for ($x = 0; $x < count($refs_arr); $x++) {
|
||||||
$refs_arr[$x] = Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''], $refs_arr[$x]));
|
$refs_arr[$x] = Email::msgid2iri(str_replace(['<', '>', ' '], ['', '', ''], $refs_arr[$x]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
|
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
|
||||||
|
|
|
@ -29,11 +29,15 @@ class PollContacts
|
||||||
$condition = ['network' => [Protocol::FEED, Protocol::MAIL], 'self' => false, 'blocked' => false, 'archive' => false];
|
$condition = ['network' => [Protocol::FEED, Protocol::MAIL], 'self' => false, 'blocked' => false, 'archive' => false];
|
||||||
|
|
||||||
if (!empty($abandon_days)) {
|
if (!empty($abandon_days)) {
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]);
|
$condition,
|
||||||
|
["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`)", 0]);
|
$condition,
|
||||||
|
["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`)", 0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = DBA::select('contact', ['id', 'nick', 'name', 'network', 'archive', 'last-update', 'priority', 'rating'], $condition);
|
$contacts = DBA::select('contact', ['id', 'nick', 'name', 'network', 'archive', 'last-update', 'priority', 'rating'], $condition);
|
||||||
|
|
|
@ -16,7 +16,8 @@ use Friendica\Protocol\ActivityPub;
|
||||||
/**
|
/**
|
||||||
* Send updated profile data to Diaspora and ActivityPub
|
* Send updated profile data to Diaspora and ActivityPub
|
||||||
*/
|
*/
|
||||||
class ProfileUpdate {
|
class ProfileUpdate
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Sends updated profile data to Diaspora and ActivityPub
|
* Sends updated profile data to Diaspora and ActivityPub
|
||||||
*
|
*
|
||||||
|
@ -35,7 +36,8 @@ class ProfileUpdate {
|
||||||
|
|
||||||
foreach ($inboxes as $inbox => $receivers) {
|
foreach ($inboxes as $inbox => $receivers) {
|
||||||
DI::logger()->info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub');
|
DI::logger()->info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub');
|
||||||
Worker::add(['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
Worker::add(
|
||||||
|
['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
|
||||||
'APDelivery',
|
'APDelivery',
|
||||||
Delivery::PROFILEUPDATE,
|
Delivery::PROFILEUPDATE,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -14,11 +14,13 @@ use Friendica\Model\Item;
|
||||||
/**
|
/**
|
||||||
* Posts items that where spooled because they couldn't be posted.
|
* Posts items that where spooled because they couldn't be posted.
|
||||||
*/
|
*/
|
||||||
class SpoolPost {
|
class SpoolPost
|
||||||
public static function execute() {
|
{
|
||||||
|
public static function execute()
|
||||||
|
{
|
||||||
$path = System::getSpoolPath();
|
$path = System::getSpoolPath();
|
||||||
|
|
||||||
if (($path != '') && is_writable($path)){
|
if (($path != '') && is_writable($path)) {
|
||||||
if ($dh = opendir($path)) {
|
if ($dh = opendir($path)) {
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,14 @@ class AutomaticInstallationConsoleTest extends ConsoleTestCase
|
||||||
*/
|
*/
|
||||||
private $dice;
|
private $dice;
|
||||||
|
|
||||||
public function setUp() : void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
static::markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
|
static::markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->setUpVfsDir();;
|
$this->setUpVfsDir();
|
||||||
|
;
|
||||||
|
|
||||||
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
||||||
$this->root->getChild('config')
|
$this->root->getChild('config')
|
||||||
|
@ -562,22 +563,22 @@ CONF;
|
||||||
|
|
||||||
$console = new AutomaticInstallation($this->consoleArgv);
|
$console = new AutomaticInstallation($this->consoleArgv);
|
||||||
|
|
||||||
$option = function($var, $cat, $key) use ($data, $console) {
|
$option = function ($var, $cat, $key) use ($data, $console) {
|
||||||
if (!empty($data[$cat][$key])) {
|
if (!empty($data[$cat][$key])) {
|
||||||
$console->setOption($var, $data[$cat][$key]);
|
$console->setOption($var, $data[$cat][$key]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$option('dbhost' , 'database', 'hostname');
|
$option('dbhost', 'database', 'hostname');
|
||||||
$option('dbport' , 'database', 'port');
|
$option('dbport', 'database', 'port');
|
||||||
$option('dbuser' , 'database', 'username');
|
$option('dbuser', 'database', 'username');
|
||||||
$option('dbpass' , 'database', 'password');
|
$option('dbpass', 'database', 'password');
|
||||||
$option('dbdata' , 'database', 'database');
|
$option('dbdata', 'database', 'database');
|
||||||
$option('url' , 'system' , 'url');
|
$option('url', 'system', 'url');
|
||||||
$option('phppath' , 'config' , 'php_path');
|
$option('phppath', 'config', 'php_path');
|
||||||
$option('admin' , 'config' , 'admin_email');
|
$option('admin', 'config', 'admin_email');
|
||||||
$option('tz' , 'system' , 'default_timezone');
|
$option('tz', 'system', 'default_timezone');
|
||||||
$option('lang' , 'system' , 'language');
|
$option('lang', 'system', 'language');
|
||||||
$option('basepath' , 'system' , 'basepath');
|
$option('basepath', 'system', 'basepath');
|
||||||
|
|
||||||
$txt = $this->dumpExecute($console);
|
$txt = $this->dumpExecute($console);
|
||||||
|
|
||||||
|
|
16
update.php
16
update.php
|
@ -650,13 +650,19 @@ function pre_update_1377()
|
||||||
|
|
||||||
function update_1380()
|
function update_1380()
|
||||||
{
|
{
|
||||||
if (!DBA::e("UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`iid` SET `notify`.`uri-id` = `item`.`uri-id` WHERE `notify`.`uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
|
if (!DBA::e(
|
||||||
Notification\ObjectType::ITEM, Notification\ObjectType::PERSON)) {
|
"UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`iid` SET `notify`.`uri-id` = `item`.`uri-id` WHERE `notify`.`uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
|
||||||
|
Notification\ObjectType::ITEM,
|
||||||
|
Notification\ObjectType::PERSON
|
||||||
|
)) {
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::e("UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`parent` SET `notify`.`parent-uri-id` = `item`.`uri-id` WHERE `notify`.`parent-uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
|
if (!DBA::e(
|
||||||
Notification\ObjectType::ITEM, Notification\ObjectType::PERSON)) {
|
"UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`parent` SET `notify`.`parent-uri-id` = `item`.`uri-id` WHERE `notify`.`parent-uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
|
||||||
|
Notification\ObjectType::ITEM,
|
||||||
|
Notification\ObjectType::PERSON
|
||||||
|
)) {
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,7 +1021,7 @@ function update_1439()
|
||||||
if (!empty($fcontact['url'])) {
|
if (!empty($fcontact['url'])) {
|
||||||
$id = Contact::getIdForURL($fcontact['url']);
|
$id = Contact::getIdForURL($fcontact['url']);
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
DBA::update('intro',['suggest-cid' => $id], ['id' => $intro['id']]);
|
DBA::update('intro', ['suggest-cid' => $id], ['id' => $intro['id']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,11 @@ header('Last-Modified: '.$modified);
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
|
||||||
$cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
|
$cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
|
||||||
$cached_etag = str_replace(['"', "-gzip"], ['', ''],
|
$cached_etag = str_replace(
|
||||||
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
|
['"', "-gzip"],
|
||||||
|
['', ''],
|
||||||
|
stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])
|
||||||
|
);
|
||||||
|
|
||||||
if (($cached_modified == $modified) && ($cached_etag == $etag)) {
|
if (($cached_modified == $modified) && ($cached_etag == $etag)) {
|
||||||
throw new NotModifiedException();
|
throw new NotModifiedException();
|
||||||
|
|
Loading…
Add table
Reference in a new issue