diff --git a/boot.php b/boot.php
index 3571a77c1..d2597b378 100644
--- a/boot.php
+++ b/boot.php
@@ -184,79 +184,6 @@ define('TERM_OBJ_POST', Term::OBJECT_TYPE_POST);
/** @deprecated since 2019.03, use Term::OBJECT_TYPE_PHOTO instead */
define('TERM_OBJ_PHOTO', Term::OBJECT_TYPE_PHOTO);
-/**
- * @name Namespaces
- *
- * Various namespaces we may need to parse
- * @{
- */
-define('NAMESPACE_ZOT', 'http://purl.org/zot');
-define('NAMESPACE_DFRN', 'http://purl.org/macgirvin/dfrn/1.0');
-define('NAMESPACE_THREAD', 'http://purl.org/syndication/thread/1.0');
-define('NAMESPACE_TOMB', 'http://purl.org/atompub/tombstones/1.0');
-define('NAMESPACE_ACTIVITY2', 'https://www.w3.org/ns/activitystreams#');
-define('NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/');
-define('NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/');
-define('NAMESPACE_MEDIA', 'http://purl.org/syndication/atommedia');
-define('NAMESPACE_SALMON_ME', 'http://salmon-protocol.org/ns/magic-env');
-define('NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe');
-define('NAMESPACE_GEORSS', 'http://www.georss.org/georss');
-define('NAMESPACE_POCO', 'http://portablecontacts.net/spec/1.0');
-define('NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates-from');
-define('NAMESPACE_OSTATUS', 'http://ostatus.org/schema/1.0');
-define('NAMESPACE_STATUSNET', 'http://status.net/schema/api/1/');
-define('NAMESPACE_ATOM1', 'http://www.w3.org/2005/Atom');
-define('NAMESPACE_MASTODON', 'http://mastodon.social/schema/1.0');
-/* @}*/
-
-/**
- * @name Activity
- *
- * Activity stream defines
- * @{
- */
-define('ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like');
-define('ACTIVITY_DISLIKE', NAMESPACE_DFRN . '/dislike');
-define('ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes');
-define('ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno');
-define('ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe');
-
-define('ACTIVITY_OBJ_HEART', NAMESPACE_DFRN . '/heart');
-
-define('ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend');
-define('ACTIVITY_REQ_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'request-friend');
-define('ACTIVITY_UNFRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'remove-friend');
-define('ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow');
-define('ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following');
-define('ACTIVITY_JOIN', NAMESPACE_ACTIVITY_SCHEMA . 'join');
-
-define('ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post');
-define('ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update');
-define('ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag');
-define('ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite');
-define('ACTIVITY_UNFAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'unfavorite');
-define('ACTIVITY_SHARE', NAMESPACE_ACTIVITY_SCHEMA . 'share');
-define('ACTIVITY_DELETE', NAMESPACE_ACTIVITY_SCHEMA . 'delete');
-define('ACTIVITY2_ANNOUNCE', NAMESPACE_ACTIVITY2 . 'Announce');
-
-define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke');
-
-define('ACTIVITY_OBJ_BOOKMARK', NAMESPACE_ACTIVITY_SCHEMA . 'bookmark');
-define('ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment');
-define('ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note');
-define('ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person');
-define('ACTIVITY_OBJ_IMAGE', NAMESPACE_ACTIVITY_SCHEMA . 'image');
-define('ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo');
-define('ACTIVITY_OBJ_VIDEO', NAMESPACE_ACTIVITY_SCHEMA . 'video');
-define('ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo');
-define('ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album');
-define('ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event');
-define('ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group');
-define('ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN . '/tagterm');
-define('ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN . '/profile');
-define('ACTIVITY_OBJ_QUESTION', 'http://activityschema.org/object/question');
-/* @}*/
-
/**
* @name Gravity
*
diff --git a/composer.json b/composer.json
index 9ed9017d8..e372547aa 100644
--- a/composer.json
+++ b/composer.json
@@ -28,15 +28,15 @@
"ext-xml": "*",
"asika/simple-console": "^1.0",
"bacon/bacon-qr-code": "^1.0",
- "divineomega/password_exposed": "^2.4",
- "ezyang/htmlpurifier": "~4.7.0",
+ "divineomega/password_exposed": "^2.8",
+ "ezyang/htmlpurifier": "^4.7",
"friendica/json-ld": "^1.0",
- "league/html-to-markdown": "~4.8.0",
- "level-2/dice": ">1.0",
+ "league/html-to-markdown": "^4.8",
+ "level-2/dice": "^4",
"lightopenid/lightopenid": "dev-master",
"michelf/php-markdown": "^1.7",
- "mobiledetect/mobiledetectlib": "2.8.*",
- "monolog/monolog": "^1.24",
+ "mobiledetect/mobiledetectlib": "^2.8",
+ "monolog/monolog": "^1.25",
"nikic/fast-route": "^1.3",
"paragonie/hidden-string": "^1.0",
"pear/console_table": "^1.3",
@@ -46,18 +46,18 @@
"psr/container": "^1.0",
"seld/cli-prompt": "^1.0",
"smarty/smarty": "^3.1",
- "fxp/composer-asset-plugin": "~1.3",
+ "fxp/composer-asset-plugin": "^1.4",
"bower-asset/base64": "^1.0",
- "bower-asset/chart-js": "^2.7",
+ "bower-asset/chart-js": "^2.8",
"bower-asset/dompurify": "^1.0",
"bower-asset/perfect-scrollbar": "^0.6",
- "bower-asset/vue": "^2.5",
+ "bower-asset/vue": "^2.6",
"npm-asset/jquery": "^2.0",
"npm-asset/jquery-colorbox": "^1.6",
- "npm-asset/jquery-datetimepicker": "^2.4.0",
+ "npm-asset/jquery-datetimepicker": "^2.5",
"npm-asset/jgrowl": "^1.4",
- "npm-asset/moment": "^2.20.1",
- "npm-asset/fullcalendar": "^3.0.1",
+ "npm-asset/moment": "^2.24",
+ "npm-asset/fullcalendar": "^3.10",
"npm-asset/cropperjs": "1.2.2",
"npm-asset/imagesloaded": "4.1.4",
"npm-asset/typeahead.js": "^0.11.1",
@@ -83,7 +83,6 @@
"include/dba.php",
"include/enotify.php",
"include/items.php",
- "include/text.php",
"boot.php"
]
},
diff --git a/composer.lock b/composer.lock
index 3aad3a154..8e55db88d 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "eda94f02683bea49b3d506d770749277",
+ "content-hash": "34ad225ce21474eb84ce78047d9f2c01",
"packages": [
{
"name": "asika/simple-console",
@@ -1128,6 +1128,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.2.2.tgz",
+ "reference": null,
"shasum": "30dc7a7ce872155b23a33bd10ad4c76c0d613f55"
},
"require-dev": {
@@ -1221,6 +1222,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/ev-emitter/-/ev-emitter-1.1.1.tgz",
+ "reference": null,
"shasum": "8f18b0ce5c76a5d18017f71c0a795c65b9138f2a"
},
"type": "npm-asset-library",
@@ -1263,6 +1265,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/fullcalendar/-/fullcalendar-3.10.1.tgz",
+ "reference": null,
"shasum": "cca3f9a2656a7e978a3f3facb7f35934a91185db"
},
"type": "npm-asset-library",
@@ -1309,6 +1312,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/imagesloaded/-/imagesloaded-4.1.4.tgz",
+ "reference": null,
"shasum": "1376efcd162bb768c34c3727ac89cc04051f3cc7"
},
"require": {
@@ -1372,6 +1376,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/jgrowl/-/jgrowl-1.4.6.tgz",
+ "reference": null,
"shasum": "2736e332aaee73ccf0a14a5f0066391a0a13f4a3"
},
"require-dev": {
@@ -1412,6 +1417,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
+ "reference": null,
"shasum": "2c89d6889b5eac522a7eea32c14521559c6cbf02"
},
"require-dev": {
@@ -1482,6 +1488,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/jquery-colorbox/-/jquery-colorbox-1.6.4.tgz",
+ "reference": null,
"shasum": "799452523a6c494839224ef702e807deb9c06cc5"
},
"require": {
@@ -1528,6 +1535,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/jquery-datetimepicker/-/jquery-datetimepicker-2.5.21.tgz",
+ "reference": null,
"shasum": "00c388a78df2732fedfdb5c6529b6e84d53e0235"
},
"require": {
@@ -1585,6 +1593,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
+ "reference": null,
"shasum": "06f0335f16e353a695e7206bf50503cb523a6ee5"
},
"require-dev": {
@@ -1639,6 +1648,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
+ "reference": null,
"shasum": "0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
},
"type": "npm-asset-library",
@@ -1755,6 +1765,7 @@
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/typeahead.js/-/typeahead.js-0.11.1.tgz",
+ "reference": null,
"shasum": "4e64e671b22310a8606f4aec805924ba84b015b8"
},
"require": {
@@ -2828,34 +2839,32 @@
"packages-dev": [
{
"name": "doctrine/instantiator",
- "version": "1.2.0",
+ "version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
- "reference": "a2c590166b2133a4633738648b6b064edae0814a"
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
- "reference": "a2c590166b2133a4633738648b6b064edae0814a",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
- "php": "^7.1"
+ "php": ">=5.3,<8.0-DEV"
},
"require-dev": {
- "doctrine/coding-standard": "^6.0",
+ "athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
- "phpbench/phpbench": "^0.13",
- "phpstan/phpstan-phpunit": "^0.11",
- "phpstan/phpstan-shim": "^0.11",
- "phpunit/phpunit": "^7.0"
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2.x-dev"
+ "dev-master": "1.0.x-dev"
}
},
"autoload": {
@@ -2875,12 +2884,12 @@
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
+ "homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
- "time": "2019-03-17T17:37:11+00:00"
+ "time": "2015-06-14T21:17:01+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@@ -3091,28 +3100,25 @@
},
{
"name": "myclabs/deep-copy",
- "version": "1.9.3",
+ "version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
- "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea"
+ "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea",
- "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
+ "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
- "php": "^7.1"
- },
- "replace": {
- "myclabs/deep-copy": "self.version"
+ "php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
- "phpunit/phpunit": "^7.1"
+ "phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
@@ -3135,7 +3141,7 @@
"object",
"object graph"
],
- "time": "2019-08-09T12:45:53+00:00"
+ "time": "2017-10-19T19:58:43+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@@ -3838,7 +3844,7 @@
}
],
"description": "Provides the functionality to compare PHP values for equality",
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
@@ -3940,7 +3946,7 @@
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "homepage": "https://github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
@@ -4008,7 +4014,7 @@
}
],
"description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "homepage": "https://github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
@@ -4060,7 +4066,7 @@
}
],
"description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "homepage": "https://github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
@@ -4162,7 +4168,7 @@
}
],
"description": "Provides functionality to recursively process PHP variables",
- "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "homepage": "https://github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00"
},
{
@@ -4310,20 +4316,20 @@
},
{
"name": "symfony/yaml",
- "version": "v4.3.4",
+ "version": "v3.4.32",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686"
+ "reference": "768f817446da74a776a31eea335540f9dcb53942"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686",
- "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/768f817446da74a776a31eea335540f9dcb53942",
+ "reference": "768f817446da74a776a31eea335540f9dcb53942",
"shasum": ""
},
"require": {
- "php": "^7.1.3",
+ "php": "^5.5.9|>=7.0.8",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
@@ -4338,7 +4344,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -4365,7 +4371,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2019-08-20T14:27:59+00:00"
+ "time": "2019-09-10T10:38:46+00:00"
},
{
"name": "webmozart/assert",
diff --git a/doc/Addons.md b/doc/Addons.md
index 0382cee49..69b591a82 100644
--- a/doc/Addons.md
+++ b/doc/Addons.md
@@ -503,16 +503,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('item_photo_menu', $args);
Hook::callAll('jot_tool', $jotplugins);
-### include/text.php
-
- Hook::callAll('contact_block_end', $arr);
- Hook::callAll('poke_verbs', $arr);
- Hook::callAll('put_item_in_cache', $hook_data);
- Hook::callAll('prepare_body_init', $item);
- Hook::callAll('prepare_body_content_filter', $hook_data);
- Hook::callAll('prepare_body', $hook_data);
- Hook::callAll('prepare_body_final', $hook_data);
-
### include/items.php
Hook::callAll('page_info_data', $data);
@@ -649,6 +639,11 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('post_remote_end', $posted_item);
Hook::callAll('tagged', $arr);
Hook::callAll('post_local_end', $new_item);
+ Hook::callAll('put_item_in_cache', $hook_data);
+ Hook::callAll('prepare_body_init', $item);
+ Hook::callAll('prepare_body_content_filter', $hook_data);
+ Hook::callAll('prepare_body', $hook_data);
+ Hook::callAll('prepare_body_final', $hook_data);
### src/Model/Contact.php
@@ -673,6 +668,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('register_account', $uid);
Hook::callAll('remove_user', $user);
+### src/Content/ContactBlock.php
+
+ Hook::callAll('contact_block_end', $arr);
+
### src/Content/Text/BBCode.php
Hook::callAll('bbcode', $text);
@@ -746,6 +745,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
+### src/Core/L10n/L10n.php
+
+ Hook::callAll('poke_verbs', $arr);
+
### src/Core/Worker.php
Hook::callAll("proc_run", $arr);
diff --git a/doc/de/Addons.md b/doc/de/Addons.md
index 3cbbb4b0b..755db95d0 100644
--- a/doc/de/Addons.md
+++ b/doc/de/Addons.md
@@ -226,16 +226,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('item_photo_menu', $args);
Hook::callAll('jot_tool', $jotplugins);
-### include/text.php
-
- Hook::callAll('contact_block_end', $arr);
- Hook::callAll('poke_verbs', $arr);
- Hook::callAll('put_item_in_cache', $hook_data);
- Hook::callAll('prepare_body_init', $item);
- Hook::callAll('prepare_body_content_filter', $hook_data);
- Hook::callAll('prepare_body', $hook_data);
- Hook::callAll('prepare_body_final', $hook_data);
-
### include/items.php
Hook::callAll('page_info_data', $data);
@@ -365,6 +355,11 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('post_remote_end', $posted_item);
Hook::callAll('tagged', $arr);
Hook::callAll('post_local_end', $new_item);
+ Hook::callAll('put_item_in_cache', $hook_data);
+ Hook::callAll('prepare_body_init', $item);
+ Hook::callAll('prepare_body_content_filter', $hook_data);
+ Hook::callAll('prepare_body', $hook_data);
+ Hook::callAll('prepare_body_final', $hook_data);
### src/Model/Contact.php
@@ -387,6 +382,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('register_account', $uid);
Hook::callAll('remove_user', $user);
+
+### src/Content/ContactBlock.php
+
+ Hook::callAll('contact_block_end', $arr);
### src/Content/Text/BBCode.php
@@ -457,6 +456,18 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll($a->module.'_post_'.$selname, $o);
Hook::callAll('jot_networks', $jotnets);
+### src/Core/Authentication.php
+
+ Hook::callAll('logged_in', $a->user);
+
+### src/Core/Hook.php
+
+ self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
+
+### src/Core/L10n/L10n.php
+
+ Hook::callAll('poke_verbs', $arr);
+
### src/Core/Worker.php
Hook::callAll("proc_run", $arr);
diff --git a/include/api.php b/include/api.php
index 7daf13455..24a0585ee 100644
--- a/include/api.php
+++ b/include/api.php
@@ -7,6 +7,7 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
@@ -15,7 +16,6 @@ use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
-use Friendica\Core\NotificationsManager;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Session;
@@ -26,6 +26,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Mail;
+use Friendica\Model\Notify;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
@@ -41,6 +42,7 @@ use Friendica\Network\HTTPException\NotImplementedException;
use Friendica\Network\HTTPException\TooManyRequestsException;
use Friendica\Network\HTTPException\UnauthorizedException;
use Friendica\Object\Image;
+use Friendica\Protocol\Activity;
use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@@ -1374,7 +1376,7 @@ function api_get_item(array $condition)
*/
function api_users_show($type)
{
- $a = \Friendica\BaseObject::getApp();
+ $a = BaseObject::getApp();
$user_info = api_get_user($a);
@@ -2839,19 +2841,19 @@ function api_format_items_activities($item, $type = "json")
// get user data and add it to the array of the activity
$user = api_get_user($a, $parent_item['author-id']);
switch ($parent_item['verb']) {
- case ACTIVITY_LIKE:
+ case Activity::LIKE:
$activities['like'][] = $user;
break;
- case ACTIVITY_DISLIKE:
+ case Activity::DISLIKE:
$activities['dislike'][] = $user;
break;
- case ACTIVITY_ATTEND:
+ case Activity::ATTEND:
$activities['attendyes'][] = $user;
break;
- case ACTIVITY_ATTENDNO:
+ case Activity::ATTENDNO:
$activities['attendno'][] = $user;
break;
- case ACTIVITY_ATTENDMAYBE:
+ case Activity::ATTENDMAYBE:
$activities['attendmaybe'][] = $user;
break;
default:
@@ -2947,7 +2949,7 @@ function api_format_items_profiles($profile_row)
*/
function api_format_items($items, $user_info, $filter_user = false, $type = "json")
{
- $a = \Friendica\BaseObject::getApp();
+ $a = BaseObject::getApp();
$ret = [];
@@ -2981,7 +2983,7 @@ function api_format_items($items, $user_info, $filter_user = false, $type = "jso
*/
function api_format_item($item, $type = "json", $status_user = null, $author_user = null, $owner_user = null)
{
- $a = \Friendica\BaseObject::getApp();
+ $a = BaseObject::getApp();
if (empty($status_user) || empty($author_user) || empty($owner_user)) {
list($status_user, $author_user, $owner_user) = api_item_get_user($a, $item);
@@ -5110,7 +5112,7 @@ function api_get_announce($item)
}
$fields = ['author-id', 'author-name', 'author-link', 'author-avatar'];
- $activity = Item::activityToIndex(ACTIVITY2_ANNOUNCE);
+ $activity = Item::activityToIndex(Activity::ANNOUNCE);
$condition = ['parent-uri' => $item['uri'], 'gravity' => GRAVITY_ACTIVITY, 'uid' => [0, $item['uid']], 'activity' => $activity];
$announce = Item::selectFirstForUser($item['uid'], $fields, $condition, ['order' => ['received' => true]]);
if (!DBA::isResult($announce)) {
@@ -6039,7 +6041,8 @@ function api_friendica_notification($type)
if ($a->argc!==3) {
throw new BadRequestException("Invalid argument count");
}
- $nm = new NotificationsManager();
+ /** @var Notify $nm */
+ $nm = BaseObject::getClass(Notify::class);
$notes = $nm->getAll([], ['seen' => 'ASC', 'date' => 'DESC'], 50);
@@ -6083,7 +6086,8 @@ function api_friendica_notification_seen($type)
$id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
- $nm = new NotificationsManager();
+ /** @var Notify $nm */
+ $nm = BaseObject::getClass(Notify::class);
$note = $nm->getByID($id);
if (is_null($note)) {
throw new BadRequestException("Invalid argument");
diff --git a/include/conversation.php b/include/conversation.php
index b6faa4d2c..84e47d34e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -4,8 +4,10 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
+use Friendica\Content\Item as ContentItem;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
@@ -24,12 +26,13 @@ use Friendica\Model\Profile;
use Friendica\Model\Term;
use Friendica\Object\Post;
use Friendica\Object\Thread;
+use Friendica\Protocol\Activity;
+use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
-use Friendica\Util\Temporal;
use Friendica\Util\Strings;
+use Friendica\Util\Temporal;
use Friendica\Util\XML;
-use Friendica\Util\Crypto;
function item_extract_images($body) {
@@ -138,12 +141,15 @@ function localize_item(&$item)
During the further steps of the database restructuring I would like to address this issue.
*/
+ /** @var Activity $activity */
+ $activity = BaseObject::getClass(Activity::class);
+
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
- if (activity_match($item['verb'], ACTIVITY_LIKE)
- || activity_match($item['verb'], ACTIVITY_DISLIKE)
- || activity_match($item['verb'], ACTIVITY_ATTEND)
- || activity_match($item['verb'], ACTIVITY_ATTENDNO)
- || activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
+ if ($activity->match($item['verb'], Activity::LIKE)
+ || $activity->match($item['verb'], Activity::DISLIKE)
+ || $activity->match($item['verb'], Activity::ATTEND)
+ || $activity->match($item['verb'], Activity::ATTENDNO)
+ || $activity->match($item['verb'], Activity::ATTENDMAYBE)) {
$fields = ['author-link', 'author-name', 'verb', 'object-type', 'resource-id', 'body', 'plink'];
$obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]);
@@ -155,9 +161,9 @@ function localize_item(&$item)
$objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
switch ($obj['verb']) {
- case ACTIVITY_POST:
+ case Activity::POST:
switch ($obj['object-type']) {
- case ACTIVITY_OBJ_EVENT:
+ case Activity\ObjectType::EVENT:
$post_type = L10n::t('event');
break;
default:
@@ -178,24 +184,24 @@ function localize_item(&$item)
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
$bodyverb = '';
- if (activity_match($item['verb'], ACTIVITY_LIKE)) {
+ if ($activity->match($item['verb'], Activity::LIKE)) {
$bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
+ } elseif ($activity->match($item['verb'], Activity::DISLIKE)) {
$bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTEND)) {
+ } elseif ($activity->match($item['verb'], Activity::ATTEND)) {
$bodyverb = L10n::t('%1$s attends %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTENDNO)) {
+ } elseif ($activity->match($item['verb'], Activity::ATTENDNO)) {
$bodyverb = L10n::t('%1$s doesn\'t attend %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
+ } elseif ($activity->match($item['verb'], Activity::ATTENDMAYBE)) {
$bodyverb = L10n::t('%1$s attends maybe %2$s\'s %3$s');
}
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
}
- if (activity_match($item['verb'], ACTIVITY_FRIEND)) {
+ if ($activity->match($item['verb'], Activity::FRIEND)) {
- if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
+ if ($item['object-type']=="" || $item['object-type']!== Activity\ObjectType::PERSON) return;
$Aname = $item['author-name'];
$Alink = $item['author-link'];
@@ -225,12 +231,12 @@ function localize_item(&$item)
$item['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$Bphoto;
}
- if (stristr($item['verb'], ACTIVITY_POKE)) {
+ if (stristr($item['verb'], Activity::POKE)) {
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
if (!$verb) {
return;
}
- if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) {
+ if ($item['object-type']=="" || $item['object-type']!== Activity\ObjectType::PERSON) {
return;
}
@@ -275,7 +281,7 @@ function localize_item(&$item)
}
- if (activity_match($item['verb'], ACTIVITY_TAG)) {
+ if ($activity->match($item['verb'], Activity::TAG)) {
$fields = ['author-id', 'author-link', 'author-name', 'author-network',
'verb', 'object-type', 'resource-id', 'body', 'plink'];
$obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]);
@@ -292,9 +298,9 @@ function localize_item(&$item)
$objauthor = '[url=' . Contact::magicLinkByContact($author_arr) . ']' . $obj['author-name'] . '[/url]';
switch ($obj['verb']) {
- case ACTIVITY_POST:
+ case Activity::POST:
switch ($obj['object-type']) {
- case ACTIVITY_OBJ_EVENT:
+ case Activity\ObjectType::EVENT:
$post_type = L10n::t('event');
break;
default:
@@ -320,7 +326,7 @@ function localize_item(&$item)
$item['body'] = L10n::t('%1$s tagged %2$s\'s %3$s with %4$s', $author, $objauthor, $plink, $tag);
}
- if (activity_match($item['verb'], ACTIVITY_FAVORITE)) {
+ if ($activity->match($item['verb'], Activity::FAVORITE)) {
if ($item['object-type'] == "") {
return;
}
@@ -393,19 +399,18 @@ function count_descendants($item) {
function visible_activity($item) {
- /*
- * likes (etc.) can apply to other things besides posts. Check if they are post children,
- * in which case we handle them specially
- */
- $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE, ACTIVITY_FOLLOW, ACTIVITY2_ANNOUNCE];
- foreach ($hidden_activities as $act) {
- if (activity_match($item['verb'], $act)) {
- return false;
- }
+ /** @var Activity $activity */
+ $activity = BaseObject::getClass(Activity::class);
+
+ if ($activity->isHidden($item['verb'])) {
+ return false;
}
// @TODO below if() block can be rewritten to a single line: $isVisible = allConditionsHere;
- if (activity_match($item['verb'], ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE && empty($item['self']) && $item['uid'] == local_user()) {
+ if ($activity->match($item['verb'], Activity::FOLLOW) &&
+ $item['object-type'] === Activity\ObjectType::NOTE &&
+ empty($item['self']) &&
+ $item['uid'] == local_user()) {
return false;
}
@@ -663,7 +668,10 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
$body = Item::prepareBody($item, true, $preview);
- list($categories, $folders) = get_cats_and_terms($item);
+ /** @var ContentItem $contItem */
+ $contItem = BaseObject::getClass(ContentItem::class);
+
+ list($categories, $folders) = $contItem->determineCategoriesTerms($item);
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) {
$title = ucfirst($item['content-warning']);
@@ -804,7 +812,7 @@ function conversation_fetch_comments($thread_items) {
$received = '';
while ($row = Item::fetch($thread_items)) {
- if (($row['verb'] == ACTIVITY2_ANNOUNCE) && !empty($row['contact-uid']) && ($row['received'] > $received) && ($row['thr-parent'] == $row['parent-uri'])) {
+ if (($row['verb'] == Activity::ANNOUNCE) && !empty($row['contact-uid']) && ($row['received'] > $received) && ($row['thr-parent'] == $row['parent-uri'])) {
$actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
$received = $row['received'];
}
@@ -996,28 +1004,31 @@ function builtin_activity_puller($item, &$conv_responses) {
switch ($mode) {
case 'like':
- $verb = ACTIVITY_LIKE;
+ $verb = Activity::LIKE;
break;
case 'dislike':
- $verb = ACTIVITY_DISLIKE;
+ $verb = Activity::DISLIKE;
break;
case 'attendyes':
- $verb = ACTIVITY_ATTEND;
+ $verb = Activity::ATTEND;
break;
case 'attendno':
- $verb = ACTIVITY_ATTENDNO;
+ $verb = Activity::ATTENDNO;
break;
case 'attendmaybe':
- $verb = ACTIVITY_ATTENDMAYBE;
+ $verb = Activity::ATTENDMAYBE;
break;
case 'announce':
- $verb = ACTIVITY2_ANNOUNCE;
+ $verb = Activity::ANNOUNCE;
break;
default:
return;
}
- if (activity_match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
+ /** @var Activity $activity */
+ $activity = BaseObject::getClass(Activity::class);
+
+ if ($activity->match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
$url = Contact::magicLinkByContact($author);
@@ -1371,7 +1382,7 @@ function smart_flatten_conversation(array $parent)
if (isset($child['children']) && count($child['children'])) {
// This helps counting only the regular posts
$count_post_closure = function($var) {
- return $var['verb'] === ACTIVITY_POST;
+ return $var['verb'] === Activity::POST;
};
$child_post_count = count(array_filter($child['children'], $count_post_closure));
@@ -1383,7 +1394,7 @@ function smart_flatten_conversation(array $parent)
// Searches the post item in the children
$j = 0;
- while($child['children'][$j]['verb'] !== ACTIVITY_POST && $j < count($child['children'])) {
+ while($child['children'][$j]['verb'] !== Activity::POST && $j < count($child['children'])) {
$j ++;
}
diff --git a/include/enotify.php b/include/enotify.php
index 01c946d1f..a8090e35f 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Model\User;
+use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Friendica\Util\Strings;
@@ -338,7 +339,7 @@ function notification($params)
$hsitelink = sprintf($sitelink, ''.$sitename.'');
switch ($params['verb']) {
- case ACTIVITY_FRIEND:
+ case Activity::FRIEND:
// someone started to share with user (mostly OStatus)
$subject = L10n::t('[Friendica:Notify] A new person is sharing with you');
@@ -348,7 +349,7 @@ function notification($params)
$sitename
);
break;
- case ACTIVITY_FOLLOW:
+ case Activity::FOLLOW:
// someone started to follow the user (mostly OStatus)
$subject = L10n::t('[Friendica:Notify] You have a new follower');
@@ -385,7 +386,7 @@ function notification($params)
}
if ($params['type'] == NOTIFY_CONFIRM) {
- if ($params['verb'] == ACTIVITY_FRIEND) { // mutual connection
+ if ($params['verb'] == Activity::FRIEND) { // mutual connection
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] Connection accepted');
@@ -821,7 +822,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
if ($send_notification) {
$params["type"] = NOTIFY_SHARE;
- $params["verb"] = ACTIVITY_TAG;
+ $params["verb"] = Activity::TAG;
}
}
@@ -835,7 +836,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
if ($item["mention"] || $tagged || ($defaulttype == NOTIFY_TAGSELF)) {
$params["type"] = NOTIFY_TAGSELF;
- $params["verb"] = ACTIVITY_TAG;
+ $params["verb"] = Activity::TAG;
}
// Is it a post that the user had started?
@@ -844,7 +845,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
if ($thread['mention'] && !$thread['ignored'] && !isset($params["type"])) {
$params["type"] = NOTIFY_COMMENT;
- $params["verb"] = ACTIVITY_POST;
+ $params["verb"] = Activity::POST;
}
// And now we check for participation of one of our contacts in the thread
@@ -852,7 +853,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
if (!$thread['ignored'] && !isset($params["type"]) && Item::exists($condition)) {
$params["type"] = NOTIFY_COMMENT;
- $params["verb"] = ACTIVITY_POST;
+ $params["verb"] = Activity::POST;
}
if (isset($params["type"])) {
diff --git a/include/text.php b/include/text.php
deleted file mode 100644
index 2050e5702..000000000
--- a/include/text.php
+++ /dev/null
@@ -1,275 +0,0 @@
-<2><3>" => array(1,2,3);
- preg_match_all('/<(' . Group::FOLLOWERS . '|'. Group::MUTUALS . '|[0-9]+)>/', $s, $matches, PREG_PATTERN_ORDER);
-
- return $matches[1];
-}
-
-
-/**
- * Wrap ACL elements in angle brackets for storage
- * @param string $item
- */
-function sanitise_acl(&$item) {
- if (intval($item)) {
- $item = '<' . intval(Strings::escapeTags(trim($item))) . '>';
- } elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
- $item = '<' . $item . '>';
- } else {
- unset($item);
- }
-}
-
-
-/**
- * Convert an ACL array to a storable string
- *
- * Normally ACL permissions will be an array.
- * We'll also allow a comma-separated string.
- *
- * @param string|array $p
- * @return string
- */
-function perms2str($p) {
- $ret = '';
- if (is_array($p)) {
- $tmp = $p;
- } else {
- $tmp = explode(',', $p);
- }
-
- if (is_array($tmp)) {
- array_walk($tmp, 'sanitise_acl');
- $ret = implode('', $tmp);
- }
- return $ret;
-}
-
-/**
- * for html,xml parsing - let's say you've got
- * an attribute foobar="class1 class2 class3"
- * and you want to find out if it contains 'class3'.
- * you can't use a normal sub string search because you
- * might match 'notclass3' and a regex to do the job is
- * possible but a bit complicated.
- * pass the attribute string as $attr and the attribute you
- * are looking for as $s - returns true if found, otherwise false
- *
- * @param string $attr attribute value
- * @param string $s string to search
- * @return boolean True if found, False otherwise
- */
-function attribute_contains($attr, $s) {
- $a = explode(' ', $attr);
- return (count($a) && in_array($s,$a));
-}
-
-/**
- * Compare activity uri. Knows about activity namespace.
- *
- * @param string $haystack
- * @param string $needle
- * @return boolean
- */
-function activity_match($haystack,$needle) {
- return (($haystack === $needle) || ((basename($needle) === $haystack) && strstr($needle, NAMESPACE_ACTIVITY_SCHEMA)));
-}
-
-/**
- * quick and dirty quoted_printable encoding
- *
- * @param string $s
- * @return string
- */
-function qp($s) {
- return str_replace("%", "=", rawurlencode($s));
-}
-
-/**
- * @brief Find any non-embedded images in private items and add redir links to them
- *
- * @param App $a
- * @param array &$item The field array of an item row
- */
-function redir_private_images($a, &$item)
-{
- $matches = [];
- $cnt = preg_match_all('|\[img\](http[^\[]*?/photo/[a-fA-F0-9]+?(-[0-9]\.[\w]+?)?)\[\/img\]|', $item['body'], $matches, PREG_SET_ORDER);
- if ($cnt) {
- foreach ($matches as $mtch) {
- if (strpos($mtch[1], '/redir') !== false) {
- continue;
- }
-
- if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == Protocol::DFRN)) {
- $img_url = 'redir/' . $item['contact-id'] . '?url=' . urlencode($mtch[1]);
- $item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
- }
- }
- }
-}
-
-/**
- * @brief Given a text string, convert from bbcode to html and add smilie icons.
- *
- * @param string $text String with bbcode.
- * @return string Formatted HTML
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
-function prepare_text($text)
-{
- $s = BBCode::convert($text);
- return trim($s);
-}
-
-/**
- * return array with details for categories and folders for an item
- *
- * @param array $item
- * @return array
- *
- * [
- * [ // categories array
- * {
- * 'name': 'category name',
- * 'removeurl': 'url to remove this category',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ],
- * [ //folders array
- * {
- * 'name': 'folder name',
- * 'removeurl': 'url to remove this folder',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ]
- * ]
- */
-function get_cats_and_terms($item)
-{
- $categories = [];
- $folders = [];
- $first = true;
-
- foreach (FileTag::fileToArray($item['file'] ?? '', 'category') as $savedFolderName) {
- $categories[] = [
- 'name' => $savedFolderName,
- 'url' => "#",
- 'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&cat=' . rawurlencode($savedFolderName) : ""),
- 'first' => $first,
- 'last' => false
- ];
- $first = false;
- }
-
- if (count($categories)) {
- $categories[count($categories) - 1]['last'] = true;
- }
-
- if (local_user() == $item['uid']) {
- foreach (FileTag::fileToArray($item['file'] ?? '') as $savedFolderName) {
- $folders[] = [
- 'name' => $savedFolderName,
- 'url' => "#",
- 'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . rawurlencode($savedFolderName) : ""),
- 'first' => $first,
- 'last' => false
- ];
- $first = false;
- }
- }
-
- if (count($folders)) {
- $folders[count($folders) - 1]['last'] = true;
- }
-
- return [$categories, $folders];
-}
-
-/**
- * return number of bytes in size (K, M, G)
- * @param string $size_str
- * @return int
- */
-function return_bytes($size_str) {
- switch (substr ($size_str, -1)) {
- case 'M': case 'm': return (int)$size_str * 1048576;
- case 'K': case 'k': return (int)$size_str * 1024;
- case 'G': case 'g': return (int)$size_str * 1073741824;
- default: return $size_str;
- }
-}
-
-function bb_translate_video($s) {
-
- $matches = null;
- $r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
- if ($r) {
- foreach ($matches as $mtch) {
- if ((stristr($mtch[1], 'youtube')) || (stristr($mtch[1], 'youtu.be'))) {
- $s = str_replace($mtch[0], '[youtube]' . $mtch[1] . '[/youtube]', $s);
- } elseif (stristr($mtch[1], 'vimeo')) {
- $s = str_replace($mtch[0], '[vimeo]' . $mtch[1] . '[/vimeo]', $s);
- }
- }
- }
- return $s;
-}
-
-function undo_post_tagging($s) {
- $matches = null;
- $cnt = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $s, $matches, PREG_SET_ORDER);
- if ($cnt) {
- foreach ($matches as $mtch) {
- if (in_array($mtch[1], ['!', '@'])) {
- $contact = Contact::getDetailsByURL($mtch[2]);
- $mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
- }
- $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
- }
- }
- return $s;
-}
-
-/// @TODO Rewrite this
-function is_a_date_arg($s) {
- $i = intval($s);
-
- if ($i > 1900) {
- $y = date('Y');
-
- if ($i <= $y + 1 && strpos($s, '-') == 4) {
- $m = intval(substr($s, 5));
-
- if ($m > 0 && $m <= 12) {
- return true;
- }
- }
- }
-
- return false;
-}
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 944ba98be..c92e5493a 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -28,6 +28,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\User;
use Friendica\Network\Probe;
+use Friendica\Protocol\Activity;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@@ -538,7 +539,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
'source_link' => $combined['url'],
'source_photo' => $combined['photo'],
- 'verb' => ($mutual?ACTIVITY_FRIEND:ACTIVITY_FOLLOW),
+ 'verb' => ($mutual ? Activity::FRIEND : Activity::FOLLOW),
'otype' => 'intro'
]);
}
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index f37064573..a9e17b34b 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -27,6 +27,7 @@ use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Module\Login;
use Friendica\Network\Probe;
+use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
@@ -561,7 +562,7 @@ function dfrn_request_content(App $a)
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : L10n::t('[Name Withheld]')),
'source_link' => $r[0]['url'],
'source_photo' => $r[0]['photo'],
- 'verb' => ACTIVITY_REQ_FRIEND,
+ 'verb' => Activity::REQ_FRIEND,
'otype' => 'intro'
]);
}
diff --git a/mod/editpost.php b/mod/editpost.php
index e14baffa2..690cb2ac0 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -8,9 +8,10 @@ use Friendica\Content\Feature;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Database\DBA;
+use Friendica\Model\Contact;
use Friendica\Model\FileTag;
use Friendica\Model\Item;
-use Friendica\Database\DBA;
use Friendica\Util\Crypto;
function editpost_content(App $a)
@@ -118,3 +119,18 @@ function editpost_content(App $a)
return $o;
}
+
+function undo_post_tagging($s) {
+ $matches = null;
+ $cnt = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $s, $matches, PREG_SET_ORDER);
+ if ($cnt) {
+ foreach ($matches as $mtch) {
+ if (in_array($mtch[1], ['!', '@'])) {
+ $contact = Contact::getDetailsByURL($mtch[2]);
+ $mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
+ }
+ $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
+ }
+ }
+ return $s;
+}
diff --git a/mod/events.php b/mod/events.php
index 649a25ab1..11bb25f51 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -5,6 +5,7 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\Nav;
use Friendica\Content\Widget\CalendarExport;
use Friendica\Core\ACL;
@@ -18,6 +19,7 @@ use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Module\Login;
+use Friendica\Util\ACLFormatter;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
@@ -146,10 +148,14 @@ function events_post(App $a)
if ($share) {
- $str_group_allow = perms2str($_POST['group_allow'] ?? '');
- $str_contact_allow = perms2str($_POST['contact_allow'] ?? '');
- $str_group_deny = perms2str($_POST['group_deny'] ?? '');
- $str_contact_deny = perms2str($_POST['contact_deny'] ?? '');
+
+ /** @var ACLFormatter $aclFormatter */
+ $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+
+ $str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? '');
+ $str_contact_allow = $aclFormatter->toString($_POST['contact_allow'] ?? '');
+ $str_group_deny = $aclFormatter->toString($_POST['group_deny'] ?? '');
+ $str_contact_deny = $aclFormatter->toString($_POST['contact_deny'] ?? '');
// Undo the pseudo-contact of self, since there are real contacts now
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
diff --git a/mod/ignored.php b/mod/ignored.php
deleted file mode 100644
index 6e0cf92a6..000000000
--- a/mod/ignored.php
+++ /dev/null
@@ -1,52 +0,0 @@
-argc > 1) {
- $message_id = intval($a->argv[1]);
- }
-
- if (empty($message_id)) {
- exit();
- }
-
- $thread = Item::selectFirstThreadForUser(local_user(), ['uid', 'ignored'], ['iid' => $message_id]);
- if (!DBA::isResult($thread)) {
- exit();
- }
-
- // Numeric values are needed for the json output further below
- $ignored = ($thread['ignored'] ? 0 : 1);
-
- if ($thread['uid'] != 0) {
- DBA::update('thread', ['ignored' => $ignored], ['iid' => $message_id]);
- } else {
- DBA::update('user-item', ['ignored' => $ignored], ['iid' => $message_id, 'uid' => local_user()], true);
- }
-
- // See if we've been passed a return path to redirect to
- $return_path = $_REQUEST['return'] ?? '';
- if ($return_path) {
- $rand = '_=' . time();
- if (strpos($return_path, '?')) {
- $rand = "&$rand";
- } else {
- $rand = "?$rand";
- }
-
- $a->internalRedirect($return_path . $rand);
- }
-
- // the json doesn't really matter, it will either be 0 or 1
-
- echo json_encode($ignored);
- exit();
-}
diff --git a/mod/item.php b/mod/item.php
index 7c8ebee4a..a96d28819 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -16,6 +16,7 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
@@ -24,8 +25,8 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
-use Friendica\Core\System;
use Friendica\Core\Session;
+use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Attach;
@@ -35,8 +36,10 @@ use Friendica\Model\FileTag;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Term;
+use Friendica\Protocol\Activity;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
+use Friendica\Util\ACLFormatter;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
use Friendica\Util\Security;
@@ -131,7 +134,7 @@ function item_post(App $a) {
$toplevel_item_id = $toplevel_item['id'];
$parent_user = $toplevel_item['uid'];
- $objecttype = ACTIVITY_OBJ_COMMENT;
+ $objecttype = Activity\ObjectType::COMMENT;
}
if ($toplevel_item_id) {
@@ -269,10 +272,14 @@ function item_post(App $a) {
$str_contact_deny = $user['deny_cid'];
} else {
// use the posted permissions
- $str_group_allow = perms2str($_REQUEST['group_allow'] ?? '');
- $str_contact_allow = perms2str($_REQUEST['contact_allow'] ?? '');
- $str_group_deny = perms2str($_REQUEST['group_deny'] ?? '');
- $str_contact_deny = perms2str($_REQUEST['contact_deny'] ?? '');
+
+ /** @var ACLFormatter $aclFormatter */
+ $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+
+ $str_group_allow = $aclFormatter->toString($_REQUEST['group_allow'] ?? '');
+ $str_contact_allow = $aclFormatter->toString($_REQUEST['contact_allow'] ?? '');
+ $str_group_deny = $aclFormatter->toString($_REQUEST['group_deny'] ?? '');
+ $str_contact_deny = $aclFormatter->toString($_REQUEST['contact_deny'] ?? '');
}
$title = Strings::escapeTags(trim($_REQUEST['title'] ?? ''));
@@ -460,7 +467,7 @@ function item_post(App $a) {
$match = null;
if (!$preview && Photo::setPermissionFromBody($body, $profile_uid, $original_contact_id, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)) {
- $objecttype = ACTIVITY_OBJ_IMAGE;
+ $objecttype = Activity\ObjectType::IMAGE;
}
/*
@@ -496,11 +503,12 @@ function item_post(App $a) {
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
$posttype = Item::PT_PAGE;
- $objecttype = ACTIVITY_OBJ_BOOKMARK;
+ $objecttype = Activity\ObjectType::BOOKMARK;
}
- $body = bb_translate_video($body);
-
+ /** @var BBCode\Video $bbCodeVideo */
+ $bbCodeVideo = BaseObject::getClass(BBCode\Video::class);
+ $body = $bbCodeVideo->transform($body);
// Fold multi-line [code] sequences
$body = preg_replace('/\[\/code\]\s*\[code\]/ism', "\n", $body);
@@ -509,15 +517,15 @@ function item_post(App $a) {
// Setting the object type if not defined before
if (!$objecttype) {
- $objecttype = ACTIVITY_OBJ_NOTE; // Default value
+ $objecttype = Activity\ObjectType::NOTE; // Default value
$objectdata = BBCode::getAttachedData($body);
if ($objectdata["type"] == "link") {
- $objecttype = ACTIVITY_OBJ_BOOKMARK;
+ $objecttype = Activity\ObjectType::BOOKMARK;
} elseif ($objectdata["type"] == "video") {
- $objecttype = ACTIVITY_OBJ_VIDEO;
+ $objecttype = Activity\ObjectType::VIDEO;
} elseif ($objectdata["type"] == "photo") {
- $objecttype = ACTIVITY_OBJ_IMAGE;
+ $objecttype = Activity\ObjectType::IMAGE;
}
}
@@ -542,7 +550,7 @@ function item_post(App $a) {
}
if (!strlen($verb)) {
- $verb = ACTIVITY_POST;
+ $verb = Activity::POST;
}
if ($network == "") {
@@ -754,7 +762,7 @@ function item_post(App $a) {
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
- 'verb' => ACTIVITY_POST,
+ 'verb' => Activity::POST,
'otype' => 'item',
'parent' => $toplevel_item_id,
'parent_uri' => $toplevel_item['uri']
@@ -774,7 +782,7 @@ function item_post(App $a) {
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
- 'verb' => ACTIVITY_POST,
+ 'verb' => Activity::POST,
'otype' => 'item'
]);
}
diff --git a/mod/lockview.php b/mod/lockview.php
index eede1b6a0..9f9dcfea4 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -3,11 +3,13 @@
* @file mod/lockview.php
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Model\Group;
use Friendica\Model\Item;
+use Friendica\Util\ACLFormatter;
function lockview_content(App $a)
{
@@ -59,10 +61,13 @@ function lockview_content(App $a)
exit();
}
- $allowed_users = expand_acl($item['allow_cid']);
- $allowed_groups = expand_acl($item['allow_gid']);
- $deny_users = expand_acl($item['deny_cid']);
- $deny_groups = expand_acl($item['deny_gid']);
+ /** @var ACLFormatter $aclFormatter */
+ $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+
+ $allowed_users = $aclFormatter->expand($item['allow_cid']);
+ $allowed_groups = $aclFormatter->expand($item['allow_gid']);
+ $deny_users = $aclFormatter->expand($item['deny_cid']);
+ $deny_groups = $aclFormatter->expand($item['deny_gid']);
$o = L10n::t('Visible to:') . '
';
$l = [];
diff --git a/mod/network.php b/mod/network.php
index 0438be705..64f5cf505 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -5,6 +5,7 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Content\Nav;
@@ -51,9 +52,12 @@ function network_init(App $a)
$group_id = 0;
}
+ /** @var DateTimeFormat $dtFormat */
+ $dtFormat = BaseObject::getClass(DateTimeFormat::class);
+
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
- if (is_a_date_arg($a->argv[$x])) {
+ if ($dtFormat->isYearMonth($a->argv[$x])) {
$is_a_date_query = true;
break;
}
@@ -461,9 +465,12 @@ function networkThreadedView(App $a, $update, $parent)
$default_permissions = [];
+ /** @var DateTimeFormat $dtFormat */
+ $dtFormat = BaseObject::getClass(DateTimeFormat::class);
+
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
- if (is_a_date_arg($a->argv[$x])) {
+ if ($dtFormat->isYearMonth($a->argv[$x])) {
if ($datequery) {
$datequery2 = Strings::escapeHtml($a->argv[$x]);
} else {
diff --git a/mod/notifications.php b/mod/notifications.php
index 8fbc5dac4..88972728c 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -9,14 +9,13 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Core\L10n;
-use Friendica\Core\NotificationsManager;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
-use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Module\Login;
use Friendica\Model\Contact;
+use Friendica\Model\Notify;
function notifications_post(App $a)
{
@@ -79,13 +78,14 @@ function notifications_content(App $a)
}
$page = ($_REQUEST['page'] ?? 0) ?: 1;
- $show = $_REQUEST['show'] ?? 0;
+ $show = ($_REQUEST['show'] ?? '') === 'all';
Nav::setSelected('notifications');
$json = (($a->argc > 1 && $a->argv[$a->argc - 1] === 'json') ? true : false);
- $nm = new NotificationsManager();
+ /** @var Notify $nm */
+ $nm = \Friendica\BaseObject::getClass(Notify::class);
$o = '';
// Get the nav tabs for the notification pages
@@ -112,27 +112,27 @@ function notifications_content(App $a)
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
- $notifs = $nm->introNotifs($all, $startrec, $perpage, $id);
+ $notifs = $nm->getIntroList($all, $startrec, $perpage, $id);
// Get the network notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_header = L10n::t('Network Notifications');
- $notifs = $nm->networkNotifs($show, $startrec, $perpage);
+ $notifs = $nm->getNetworkList($show, $startrec, $perpage);
// Get the system notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_header = L10n::t('System Notifications');
- $notifs = $nm->systemNotifs($show, $startrec, $perpage);
+ $notifs = $nm->getSystemList($show, $startrec, $perpage);
// Get the personal notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_header = L10n::t('Personal Notifications');
- $notifs = $nm->personalNotifs($show, $startrec, $perpage);
+ $notifs = $nm->getPersonalList($show, $startrec, $perpage);
// Get the home notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_header = L10n::t('Home Notifications');
- $notifs = $nm->homeNotifs($show, $startrec, $perpage);
+ $notifs = $nm->getHomeList($show, $startrec, $perpage);
// fallback - redirect to main page
} else {
$a->internalRedirect('notifications');
diff --git a/mod/photos.php b/mod/photos.php
index 1789c0710..037da64b1 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -4,6 +4,7 @@
*/
use Friendica\App;
+use Friendica\BaseObject;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
@@ -14,18 +15,18 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
-use Friendica\Core\System;
use Friendica\Core\Session;
+use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
-use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Object\Image;
-use Friendica\Protocol\DFRN;
+use Friendica\Protocol\Activity;
+use Friendica\Util\ACLFormatter;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
@@ -296,10 +297,13 @@ function photos_post(App $a)
$albname = !empty($_POST['albname']) ? Strings::escapeTags(trim($_POST['albname'])) : '';
$origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : '';
- $str_group_allow = !empty($_POST['group_allow']) ? perms2str($_POST['group_allow']) : '';
- $str_contact_allow = !empty($_POST['contact_allow']) ? perms2str($_POST['contact_allow']) : '';
- $str_group_deny = !empty($_POST['group_deny']) ? perms2str($_POST['group_deny']) : '';
- $str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
+ /** @var ACLFormatter $aclFormatter */
+ $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+
+ $str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->toString($_POST['group_allow']) : '';
+ $str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
+ $str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : '';
+ $str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : '';
$resource_id = $a->argv[3];
@@ -563,24 +567,24 @@ function photos_post(App $a)
$arr['deny_cid'] = $photo['deny_cid'];
$arr['deny_gid'] = $photo['deny_gid'];
$arr['visible'] = 1;
- $arr['verb'] = ACTIVITY_TAG;
+ $arr['verb'] = Activity::TAG;
$arr['gravity'] = GRAVITY_PARENT;
- $arr['object-type'] = ACTIVITY_OBJ_PERSON;
- $arr['target-type'] = ACTIVITY_OBJ_IMAGE;
+ $arr['object-type'] = Activity\ObjectType::PERSON;
+ $arr['target-type'] = Activity\ObjectType::IMAGE;
$arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2];
$arr['origin'] = 1;
$arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
$arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
- $arr['object'] = '