Compare commits

...

507 Commits

Author SHA1 Message Date
~keith b8088d9686
Add option to enable CWs on own posts 2022-10-30 21:29:08 +00:00
Philipp f826ce70ce
Merge pull request #12078 from MrPetovan/task/4090-move-mod-wallmessage
Move mod/wallmessage.php to src/Module
2022-10-30 19:04:47 +01:00
Hypolite Petovan c5076bec18 Updated main translation file after changing strings 2022-10-30 10:49:48 -04:00
Hypolite Petovan 07dd548a10 Remove mod/wallmessage module 2022-10-30 10:49:47 -04:00
Hypolite Petovan 9561910e83 Create Profile\UnkMail module class 2022-10-30 10:49:47 -04:00
Hypolite Petovan 3865733e18 Move Model\Profile::getMyUrl to UserSessions 2022-10-30 10:49:47 -04:00
Hypolite Petovan 6a205b2e10
Merge pull request #12076 from annando/quote
Improved handling of native quotes
2022-10-30 08:43:19 -04:00
Michael eae1383f48 Merge remote-tracking branch 'upstream/develop' into quote 2022-10-30 11:38:17 +00:00
Michael b402a760a8 Symplified code 2022-10-30 10:02:12 +00:00
Michael a183723254 Improved handling of contact links 2022-10-30 10:02:01 +00:00
Michael 96a36568e2 Add quote to API 2022-10-30 01:20:05 +00:00
Michael f569ccbbc2 Code is simplyfied 2022-10-29 22:55:39 +00:00
Michael 3c169b534e Improved handling of native quotes 2022-10-29 22:11:39 +00:00
Hypolite Petovan e24078a4d2
Merge pull request #12074 from annando/fix-notification
Accepting contact request does finally work per Mastodon API
2022-10-29 15:55:40 -04:00
Michael 8bba8663fb Only fetch the needed field 2022-10-29 19:11:26 +00:00
Michael f44c9e7975 Accepting contact request does finally work per Mastodon API 2022-10-29 19:04:29 +00:00
Philipp 01c0c0a1ba
Merge pull request #12072 from MrPetovan/bug/12054-advancedcontentfilter-static-vue
[Composer] Remove bower-asset/vue dependency
2022-10-29 19:34:48 +02:00
Hypolite Petovan fed17d031c [Composer] Remove bower-asset/vue dependency
- The Bower package doesn't have the dist/vue.min.js anymore (?) which is required for the advancedcontentfilter addon
2022-10-28 21:13:45 -04:00
Hypolite Petovan 2bdf2b02e3
Merge pull request #12071 from guzzisti/patch-2
fix exception when adding a poll option without votes
2022-10-28 13:45:27 -04:00
Hypolite Petovan a2adb1cd93
Remove unused argument from L10n->tt() call in Model/Item.php 2022-10-28 13:45:09 -04:00
René Wagner b99e7a9e92
fix exception when adding an poll option without votes 2022-10-28 18:51:35 +02:00
Hypolite Petovan f418687a71
Merge pull request #12070 from annando/share
Some more improvements for posts with shares
2022-10-27 08:19:23 -04:00
Michael e31533d0d3 Possibly fix test 2022-10-27 06:31:09 +00:00
Michael deccea0228 More functions moved to content class 2022-10-27 05:44:44 +00:00
Michael c65fff6f93 Some more improvements for posts with shares 2022-10-26 17:00:55 +00:00
Hypolite Petovan 0c4ebce391
Merge pull request #12067 from Quix0r/cleanup/type-hints-002
Cleanup: missing type-hints, double-quotes, reformatted array
2022-10-26 12:03:04 -04:00
Roland Häder 498d7f690a
Changes:
- php-cs is now happy with it
2022-10-26 17:59:10 +02:00
Roland Häder 03e09627e4
Used `$this->isThreaded()` instead as suggested by @MrPetovan 2022-10-26 17:59:07 +02:00
Hypolite Petovan 4189e01987
Merge pull request #12069 from tobiasd/20221026-de
DE translation update
2022-10-26 01:36:58 -04:00
Hypolite Petovan 80dc593159
Merge pull request #12068 from tobiasd/20221026-nofollow
add a nofollow to the blocklist export link
2022-10-26 01:36:15 -04:00
Tobias Diekershoff 606dd9f5e6 DE translation update 2022-10-26 07:33:51 +02:00
Tobias Diekershoff 80a897f2f3 add a nofollow to the blocklist export link 2022-10-26 07:30:46 +02:00
Michael Vogel ff2af0a2e3
Merge pull request #12066 from MrPetovan/task/12062-revert-block-list-email
Revert "Add email notification to all users on server domain pattern block list update"
2022-10-26 05:35:25 +02:00
Roland Häder 3c50d5b70f
Changes:
- made code more readable
2022-10-26 01:31:34 +02:00
Roland Häder 2f1336339f
Changes:
- added missing type-hints
- added missing documentation
- changed double-quotes to single
- Setters do ALWAYS return void
2022-10-26 01:29:01 +02:00
Hypolite Petovan 42199d9264 Updated main translation file after removing strings 2022-10-25 19:07:55 -04:00
Hypolite Petovan 22bfd3b4d6 Revert "Add email notification to all users on server domain pattern block list update"
This reverts commit 5045f9e188 because the main stakeholder isn't using the feature and it's putting a strain on email server accountability vis-a-vis spam lists.

# Conflicts:
#	src/Moderation/DomainPatternBlocklist.php
2022-10-25 19:02:55 -04:00
Hypolite Petovan 3456ae7809
Merge pull request #12065 from Quix0r/cleanup/renaming-more-logging
Cleanups: renaming variables and more logging
2022-10-25 17:17:46 -04:00
Hypolite Petovan 158d21db14
Merge pull request #12064 from Quix0r/phpunit/temporal-test
Unit test added for Temporal utilities class
2022-10-25 17:16:58 -04:00
Roland Häder 039a4b8c72
Fixed issues by `php-cs` 2022-10-25 23:09:30 +02:00
Roland Häder 913a4a5dc0
Fixed code-standards complain by php-cs, thanks to @MrPetovan 2022-10-25 22:45:50 +02:00
Roland Häder ceffd0ef6c
Changed:
- here `Logger::level()` is okay to use
- added more logging in wall_upload.php
- formatted array and put all $array['foo'] = $foo; into a single statement
- <include|require[_once]> are all no functions, but keywords
2022-10-25 21:36:59 +02:00
Roland Häder 71e82bc861
Changed:
- added logger for any reason when upload is aborted
- renamed variables a bit to camel-case style
2022-10-25 21:35:36 +02:00
Roland Häder b1cf4cbbd5
Changes:
- added unit-test for `Temporal::getRelativeDate()` method
2022-10-25 21:30:56 +02:00
Hypolite Petovan db82bdfc44
Merge pull request #12063 from Quix0r/fixes/type-hints-reformatting
Added more type-hints + reformatted code
2022-10-25 14:54:22 -04:00
Roland Häder 5306bb3e31
Changes:
- added more missing type-hints (checked them in body of the method)
- reformatted code a little (code-style)
- moved '/.well-known/host-meta' to constant Probe::HOST_META
2022-10-25 20:25:13 +02:00
Hypolite Petovan a7e9457ef2
Merge pull request #12061 from annando/share-rework
The "share" handling is improved
2022-10-25 09:04:16 -04:00
Michael 842a4bb904 Changed function name 2022-10-25 12:40:22 +00:00
Hypolite Petovan 2555596158
Merge pull request #12055 from nupplaphil/feat/usersess_decorator
Extend `IHandleUserSessions` from `IHandleSessions` and adapt classes
2022-10-25 07:52:23 -04:00
Michael ebd175872d Improved description 2022-10-25 08:45:41 +00:00
Michael 1a0b63659b Merge remote-tracking branch 'upstream/develop' into share-rework 2022-10-25 08:31:01 +00:00
Michael f54a886a5e The "share" handling is improved 2022-10-25 06:37:23 +00:00
Philipp f03c5c7f89
implement feeback 2022-10-25 08:07:42 +02:00
Tobias Diekershoff 9b310b0dd7
Merge pull request #12060 from MrPetovan/bug/9920-contact-export
Fix condition for follows export
2022-10-25 06:57:25 +02:00
Hypolite Petovan 5f92473c6e Update main translation file after changing a string 2022-10-24 18:21:50 -04:00
Hypolite Petovan dc2d96a502 Fix condition for follows export
- Select follows instead of followers
- Filter out archived contacts
2022-10-24 18:21:10 -04:00
Hypolite Petovan 142b399c84 Reformat Module\Settings\UserExport
- Import IHandleUserSessions and DbaDefinition object in constructor
- Convert remaining double quotes to single quotes
- Convert static methods to dynamic to use class properties
- Remove unused POST permission from route
2022-10-24 18:14:59 -04:00
Hypolite Petovan a3651e464d
Merge pull request #12057 from Quix0r/rewrites/type-hints
Added missing type-hints and formatted some arrays
2022-10-24 16:10:33 -04:00
Roland Häder bf9f09182e
Changes:
- added some missing type-hints
- no need for local array `$t` (changed to "anonymous" varriant)
- formatted some arrays
2022-10-24 20:32:24 +02:00
Philipp 05b15f2824
Merge pull request #12058 from Quix0r/fixes/get-remote-userid
Fixed: Undefined property: Friendica\Core\Session\Model\UserSession::$getRemoteUserId
2022-10-24 19:40:02 +02:00
Roland Häder 54b89365bb
Fixed:
- Added missing `()` to `getRemoteUserId` which is a method, and not a property
- `Undefined property: Friendica\Core\Session\Model\UserSession::$getRemoteUserId in /var/www/.../htdocs/mod/display.php on line 192`
2022-10-24 18:29:28 +02:00
Philipp b5bc1b0844
Extend `IHandleUserSessions` from `IHandleSessions` and adapt classes 2022-10-23 20:41:17 +02:00
Tobias Diekershoff b72d727a06
Merge pull request #12051 from Quix0r/hotfix/one-dollar-to-much
Hotfix: One `$` to much ...
2022-10-23 16:25:46 +02:00
Tobias Diekershoff 19155a4bb2
Merge pull request #12050 from nupplaphil/bug/notf_session_fix
Fix missing/wrong IHandleUserSessions usages
2022-10-23 16:23:01 +02:00
Roland Häder e8fe0c52e7
Hotfix: One `$` to much ... 2022-10-23 13:15:34 +02:00
Philipp b4b9f426db
Fix missing/wrong IHandleUserSessions usages 2022-10-23 11:32:43 +02:00
Hypolite Petovan 6040dfa5e8
Merge pull request #12049 from nupplaphil/bug/ci
Fix CI with Session
2022-10-22 16:57:14 -04:00
Philipp c3df570324
Fix CI with Session 2022-10-22 20:03:15 +02:00
Hypolite Petovan 52cc6ff3cb
Merge pull request #12048 from tobiasd/20221022-ru
RU translation update THX SpcCw
2022-10-22 08:13:12 -04:00
Tobias Diekershoff 965314f213 RU translation update THX SpcCw 2022-10-22 06:44:08 +02:00
Hypolite Petovan 40f734da58
Merge pull request #12039 from nupplaphil/feat/session_util_Modules
UserSession class [3] - Refactor src/ files excluding Module/Model
2022-10-21 18:28:45 -04:00
Hypolite Petovan 854c8e6685
Merge pull request #12047 from friendica/revert-12044-bug/woordpecker_ci
Revert "Fix CI pipeline"
2022-10-21 18:26:05 -04:00
Philipp 4978765b90
Revert "Fix CI pipeline" 2022-10-21 19:55:29 +02:00
Philipp a9963dc54b
Remove Core\Session 2022-10-21 19:36:42 +02:00
Philipp 7b3caca276
Update src/Content/Widget.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-21 19:35:34 +02:00
Philipp 44a9683008
Move "submanage" Session value into own methods 2022-10-21 19:35:34 +02:00
Philipp cafb23f8f0
Reduce parentheses 2022-10-21 19:35:34 +02:00
Philipp f15878195c
make App\Router easier 2022-10-21 19:35:34 +02:00
Philipp 7b35c570f9
Move DI dependency for App class 2022-10-21 19:35:33 +02:00
Philipp 134f98e22e
Move DI dependency for Navigation\Notifications\Factory\Introduction class 2022-10-21 19:35:33 +02:00
Philipp a1997d73c2
Move DI dependency for Navigation\Notifications\Factory\FormattedNotify class 2022-10-21 19:35:33 +02:00
Philipp f1cbb41a60
Move DI dependency for Navigation\Notifications\Factory\FormattedNavNotification class 2022-10-21 19:35:33 +02:00
Philipp d76a2b6ad6
Move DI dependency for Content\Item class 2022-10-21 19:35:32 +02:00
Philipp 37ff477b55
Move DI dependency for App\Conversation class 2022-10-21 19:35:32 +02:00
Philipp fa8a32e83c
Move DI dependency for App\Router class 2022-10-21 19:35:32 +02:00
Philipp f83784cc63
Move DI dependency for App\Page class 2022-10-21 19:35:32 +02:00
Philipp b3f9cef94a
UserSession class [3] - Refactor src/ files excluding Module/Model 2022-10-21 19:35:32 +02:00
Hypolite Petovan a11c125f81
Merge pull request #12042 from nupplaphil/feat/usersession_Module_DepInj
UserSession class [6] - Refactor src/Module/ files without DI
2022-10-21 13:21:48 -04:00
Hypolite Petovan fc2cdd3992
Merge pull request #12046 from nupplaphil/bug/DI_missing
Add missing DI
2022-10-21 13:20:41 -04:00
Philipp 8ad83e5d5c
Add missing DI 2022-10-21 19:16:25 +02:00
Hypolite Petovan 0ac1c5fbf2
Merge pull request #12043 from nupplaphil/feat/usersession_view
UserSession class [7] - Refactor view/ files
2022-10-21 11:13:32 -04:00
Hypolite Petovan c815bbab52
Merge pull request #12045 from nupplaphil/bug/messages_po
Fix messages.po issue
2022-10-21 11:13:21 -04:00
Philipp 84201f0915
Update view/theme/vier/config.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-21 10:25:42 +02:00
Philipp fad1763e28
Update view/theme/quattro/config.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-21 10:25:41 +02:00
Philipp ee71086133
UserSession class [7] - Refactor view/ files 2022-10-21 10:25:41 +02:00
Philipp 22198ea495
UserSession class [6] - Refactor src/Module/ files without DI 2022-10-21 10:25:07 +02:00
Philipp bf39b5a948
Fix messages.po issue 2022-10-21 10:19:13 +02:00
Hypolite Petovan f609386ca1
Merge pull request #12041 from nupplaphil/feat/usersession_Module
UserSession class [5] - Refactor src/Module/ files with DI
2022-10-20 20:32:54 -04:00
Hypolite Petovan 1235814b02
Merge pull request #12040 from nupplaphil/feat/usersession_Model
UserSession class [4] - Refactor src/Model/ files
2022-10-20 20:07:41 -04:00
Hypolite Petovan 5868e5ac90
Merge pull request #12044 from nupplaphil/bug/woordpecker_ci
Fix CI pipeline
2022-10-20 19:52:56 -04:00
Philipp dd1482d791
Fix CI pipeline 2022-10-21 00:49:38 +02:00
Hypolite Petovan 5985563149
Merge pull request #12038 from nupplaphil/feat/session_util_2
UserSession class [2] - Refactor mod/ files
2022-10-20 18:13:48 -04:00
Philipp eecc456e0c
UserSession class [5] - Refactor src/Module/ files with DI 2022-10-20 22:59:39 +02:00
Philipp b4ffb0bde0
UserSession class [4] - Refactor src/Model/ files 2022-10-20 22:14:50 +02:00
Philipp 8dda6144a9
Remove unnecessary "use" 2022-10-20 21:06:06 +02:00
Philipp bfe68702db
UserSession class [2] - Refactor mod/ files 2022-10-20 21:02:49 +02:00
Hypolite Petovan a729f3255d
Merge pull request #12021 from nupplaphil/feat/session_util
UserSession class [1] - Add class and tests
2022-10-20 14:54:42 -04:00
Philipp 7c4611af19
Update tests/src/Core/Session/UserSessionTest.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-20 20:47:43 +02:00
Philipp 0b66b6e0d5
Move Session "exists" and "expire" to new class 2022-10-20 20:27:35 +02:00
Philipp 940619325d
Add SessionUsers class including tests 2022-10-20 20:27:34 +02:00
Michael Vogel 66a4c30eb7
Merge pull request #12037 from MrPetovan/bug/blocklist-clobbered
Fix using wrong variable in DomainPatterBlocklist::extractFromCSVFile
2022-10-20 15:57:22 +02:00
Hypolite Petovan eaf1485c6f Fix using wrong variable in DomainPatterBlocklist::extractFromCSVFile
- This was clobbering the internal block list structure from an associative array to a simple list
2022-10-20 09:45:40 -04:00
Michael Vogel 92f1a4533b
Merge pull request #12036 from tobiasd/20221020-breakingnote
added a breaking note for custom addons to the CHANGELOG
2022-10-20 10:29:38 +02:00
Tobias Diekershoff ce64148c8d
Merge pull request #12034 from annando/no-include
Legacy "include" fragments have been removed
2022-10-20 09:57:38 +02:00
Tobias Diekershoff 5a21458ae9 added a breaking note for custom addons to the CHANGELOG
With the movement of all the function from the boot.php into fitting classes
custom addons will break (e.g. local_user() calls). The note in the CHANGELOG
should be a warning and a reminder for the release notes of 2022.12.
2022-10-20 09:46:59 +02:00
Michael 4930737cc4 Legacy "include" fragments have been removed 2022-10-20 04:21:00 +00:00
Hypolite Petovan 660912351c
Merge pull request #12033 from annando/no-boot
All references to boot.php are now removed
2022-10-19 16:53:51 -04:00
Michael d3e167c77c All references to boot.php are now removed 2022-10-19 20:38:25 +00:00
Hypolite Petovan 693db1b750
Merge pull request #12032 from annando/error
Fix Error: Uncaught Exception Error: "Class "Friendica\Content\Session" not found"
2022-10-19 15:20:07 -04:00
Michael cfbba97e0a Fix Error: Uncaught Exception Error: "Class "Friendica\Content\Session" not found" 2022-10-19 19:16:01 +00:00
Hypolite Petovan 5b2af862d4
Merge pull request #12028 from annando/no-boot-src-module-4
old boot.php functions replaced in src/module (4)
2022-10-19 09:48:29 -04:00
Michael 867e23054d Updated messages.po 2022-10-19 09:23:13 -04:00
Michael d47d78f2d4 old boot.php functions replaced in src/module (4) 2022-10-19 09:23:12 -04:00
Hypolite Petovan de6eabde58
Merge pull request #12027 from annando/no-boot-src-module-3
old boot.php functions replaced in src/module (3)
2022-10-19 09:22:41 -04:00
Hypolite Petovan 956f196f7c Align pConfig calls in Module\Settings\Display 2022-10-19 09:20:48 -04:00
Hypolite Petovan 979e226d27 Suppress repetitive "missing cache key ping:events:XX" when there are no upcoming events 2022-10-19 09:17:28 -04:00
Michael ae6d67ed1f old boot.php functions replaced in src/module (3) 2022-10-19 09:14:24 -04:00
Hypolite Petovan 83390d4b00
Merge pull request #12026 from annando/no-boot-src-module-2
old boot.php functions replaced in src/module (2)
2022-10-19 09:13:45 -04:00
Michael c9f17e1ef5 old boot.php functions replaced in src/module (2) 2022-10-19 09:06:09 -04:00
Hypolite Petovan b36d4eb0dd
Merge pull request #12025 from annando/no-boot-src-module
old boot.php functions replaced in src/module
2022-10-19 09:03:20 -04:00
Hypolite Petovan 47d9f91009 Add missing use statements in modules classes 2022-10-19 09:02:53 -04:00
Michael d2da2492b7 old boot.php functions replaced in src/module 2022-10-19 08:53:45 -04:00
Hypolite Petovan ba9f145ef7
Merge pull request #12024 from annando/no-boot-src-1
old boot.php functions replaced in varous placed under /src
2022-10-19 08:05:56 -04:00
Hypolite Petovan 058abc0336
Simplify boolean statements in Content\Conversation 2022-10-19 08:05:31 -04:00
Michael ee1acba9eb old boot.php functions replaced in /src 2022-10-19 07:56:25 -04:00
Hypolite Petovan 7fc37832f7
Merge pull request #12022 from annando/no-boot-various
old boot.php functions replaced in various places
2022-10-19 07:50:42 -04:00
Hypolite Petovan 429b2e0992
Apply code standards in documentation 2022-10-19 07:50:28 -04:00
Michael 11944dda32 old boot.php functions replaced in various places 2022-10-19 07:44:08 -04:00
Hypolite Petovan c54bfd423a
Merge pull request #12020 from annando/no-boot
old boot.php functions replaced in /mod
2022-10-19 07:42:48 -04:00
Tobias Diekershoff 95fe66e0b9
Merge pull request #12030 from nupplaphil/bug/error
Fix ERROR IHandleSessions
2022-10-19 08:18:05 +02:00
Philipp 692566d93b
Fix ERROR IHandleSessions 2022-10-19 08:07:12 +02:00
Tobias Diekershoff d8fe8b1e8b
Merge pull request #12029 from annando/warning
Suppress warning on load check
2022-10-19 07:51:24 +02:00
Michael 196dda9487 Suppress warning on load check 2022-10-19 04:49:57 +00:00
Michael 5874de4743 old boot.functions replaced in /mod 2022-10-19 04:14:42 +00:00
Hypolite Petovan 69b13155f9
Merge pull request #12019 from tobiasd/20221018-fr
FR translation update THX Nicolas Derive
2022-10-18 17:00:54 -04:00
Tobias Diekershoff f4dbd69e0e FR translation update THX Nicolas Derive 2022-10-18 22:18:01 +02:00
Hypolite Petovan d369f1e1e0
Merge pull request #12018 from nupplaphil/feat/session_util
Replace Core\Session functions with DI::session methods
2022-10-18 15:45:14 -04:00
Philipp 4a2f67aa9a
Move Core\Session::clear() to DI::session()->clear() 2022-10-18 21:13:58 +02:00
Philipp a2eb0c7378
Move Core\Session::remove() to DI::session()->remove() 2022-10-18 21:13:28 +02:00
Philipp 315ed3ed22
Remove unused Core\Session::setMultiple() 2022-10-18 21:12:48 +02:00
Philipp 3a8bcb3fbf
Move Core\Session::set() to DI::session()->set() 2022-10-18 21:12:23 +02:00
Philipp dfb5792773
Remove unused Core\Session::pop() method 2022-10-18 21:11:19 +02:00
Philipp fb2b2f5c58
Remove unused Core\Session::create() method 2022-10-18 21:11:00 +02:00
Philipp 7ac86e49d1
Move Core\Session::get() to DI::session()->get() 2022-10-18 21:10:37 +02:00
Hypolite Petovan 99d5441007
Merge pull request #12017 from annando/gravity
Fix errors introduced by PR #11997
2022-10-18 14:47:13 -04:00
Michael ae82737445 Fix errors introduced by PR #11997 2022-10-18 18:32:20 +00:00
Hypolite Petovan f3abef0979
Merge pull request #11996 from Quix0r/fixes/get-relative-time-null-parameter
Fixed: "Argument 1 passed to Friendica\Util\Temporal::getRelativeDate() must be of the type string, null given"
2022-10-18 12:33:51 -04:00
Roland Häder c36da392f8
Changed:
- re-added `null` again https://github.com/friendica/friendica/pull/11900#discussion_r979248182
- removed null coalescing operator
2022-10-18 18:21:45 +02:00
Roland Häder 2773ac9909
Changed according feedback:
- $posted_date should not allow NULL, instead use `?? ''` instead
- this happened in e.g. 2FA app-specific password listing
2022-10-18 17:47:15 +02:00
Roland Häder 66b9cace9f
Changed:
- first parameter can be null
2022-10-18 17:47:15 +02:00
Hypolite Petovan bbe05f523f
Merge pull request #11997 from Quix0r/rewrite/gravity-constants
Moved GRAVITY_* constants to Item model class
2022-10-18 11:31:51 -04:00
Roland Häder 54d3d03252
Ops, code-convention not followed 2022-10-18 16:34:45 +02:00
Roland Häder 26e0469de7
Merge branch 'develop' into rewrite/gravity-constants 2022-10-18 16:34:40 +02:00
Roland Häder abe02a646c
Added missing `use` statement (again), thanks to @MrPetovan
Yes, we need more unit-testing! Not only to rely on your IDE that it will locate
it for you.
2022-10-18 16:26:35 +02:00
Roland Häder 3a2f5091d9
Added missing `use` statement, thanks to @MrPetovan 2022-10-18 16:20:21 +02:00
Hypolite Petovan 33a7260c35
Merge pull request #12016 from annando/no-eol
The EOL constant is removed
2022-10-18 10:16:12 -04:00
Michael 6f68679375 The EOL constant is removed 2022-10-18 12:29:50 +00:00
Hypolite Petovan abf52c0c11
Merge pull request #12012 from nupplaphil/feat/move_monolog
Move Monolog to Addons
2022-10-18 07:31:59 -04:00
Hypolite Petovan ab9b60b9d2
Merge pull request #12014 from annando/usertosession
The user related functions moved to the session class
2022-10-18 07:30:21 -04:00
Tobias Diekershoff 27376a3dae
Merge pull request #12015 from annando/proc-access
Check the readability before acessing /proc/loadavg
2022-10-18 11:14:19 +02:00
Michael d43122c6d8 Check the readability before acessing /proc/loadavg 2022-10-18 08:02:55 +00:00
Michael Vogel 810ea228f0
Apply suggestions from code review
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-18 07:57:59 +02:00
Michael 27e9f2b223 SIGTERM moved 2022-10-18 04:35:06 +00:00
Michael 33ac39c335 The user related functions moved to the session class 2022-10-17 21:11:00 +00:00
Philipp 497fc4e432
Move Monolog to Addons 2022-10-17 22:22:00 +02:00
Hypolite Petovan e198edf652
Merge pull request #12010 from annando/notice
Notice and Info is moved
2022-10-17 15:13:07 -04:00
Michael fdfa1f8630 The notice and info have been moved 2022-10-17 18:55:22 +00:00
Michael 20291ddc2b Merge remote-tracking branch 'upstream/develop' into notice 2022-10-17 13:32:10 +00:00
Philipp 8c084fedad
Merge pull request #12007 from annando/more-constants
The friendica constants have been moved to the app class
2022-10-17 14:27:59 +02:00
Michael e96fd5166a Fix wrong constant 2022-10-17 11:28:54 +00:00
Michael 4ff7c37f85 Replace "notice" calls 2022-10-17 11:27:32 +00:00
Michael 62a0d55fc8 The friendica constants have been moved to the app class 2022-10-17 10:37:48 +00:00
Tobias Diekershoff 54951b7be6
Merge pull request #12006 from annando/constants
Some more constants are moved to their specific classes
2022-10-17 11:42:13 +02:00
Michael b1de40cb42 Updated messages.po 2022-10-17 09:33:29 +00:00
Michael 9bac8153ae Some more constants are moved to their specific classes 2022-10-17 09:24:32 +00:00
Michael Vogel 66b0d5e847
Merge pull request #12005 from tobiasd/20221017-de
DE translation update
2022-10-17 08:30:32 +02:00
Tobias Diekershoff a994b76ebc DE translation update 2022-10-17 08:27:48 +02:00
Tobias Diekershoff 3a158d00eb
Merge pull request #12004 from annando/priorities
The priority is now a class constant
2022-10-17 08:00:14 +02:00
Michael 018858934b The priority is now a class constant 2022-10-17 05:49:55 +00:00
Hypolite Petovan b33b70f0ab
Merge pull request #12003 from annando/linked-posts
Detect linked posts and add them as quote
2022-10-16 20:04:56 -04:00
Michael 9ffa053c90 Merge remote-tracking branch 'upstream/develop' into linked-posts 2022-10-16 21:51:26 +00:00
Michael Vogel f371095d3a
Merge pull request #12002 from MrPetovan/task/11941-compose-setting
[frio] Add new frio.always_open_compose setting
2022-10-16 23:50:37 +02:00
Michael b4661b35fd Improved database.sql 2022-10-16 21:43:48 +00:00
Michael f8f0dfa91a Detect linked posts and add them as quote 2022-10-16 21:37:05 +00:00
Hypolite Petovan bcc1350f1d Updated main translation file after adding strings 2022-10-16 13:21:43 -04:00
Hypolite Petovan e556dc3c31 Add new frio.always_open_compose setting
- This setting allows the New Post button to always open the Compose page instead of the modal by default
2022-10-16 11:49:27 -04:00
Hypolite Petovan d826fe0a3b Refactor files related to the Compose page and frio theme settings
- Use dependencies instead of most DI calls in Module\Item\Compose
- Group translation strings in a subkey of the template variables array
- Rewrite array initializations in theme/frio/config
2022-10-16 11:48:28 -04:00
Hypolite Petovan 7e06127d74
Merge pull request #12001 from tobiasd/20221016-docsmysql
[docs] note the preference of MariaDB over other MySQL implementation…
2022-10-16 08:38:58 -04:00
Tobias Diekershoff a192e099ab [docs] note the preference of MariaDB over other MySQL implementation in the install docs 2022-10-16 10:14:18 +02:00
Hypolite Petovan d6fe212a49
Merge pull request #12000 from tobiasd/20221015-vagrant
updates to the vagrant VM provision and config
2022-10-15 12:23:37 -04:00
Tobias Diekershoff 9383d7849b adopt IP change in the Vagrant docs 2022-10-15 17:33:47 +02:00
Tobias Diekershoff 49ed627aed change IP of Vagrant VM 2022-10-15 17:31:57 +02:00
Hypolite Petovan 1585f711ee
Merge pull request #11999 from annando/quote-uri-id
Improve quote generation
2022-10-15 09:11:22 -04:00
Michael 8e1af9277a Improve quite generation 2022-10-15 13:00:52 +00:00
Hypolite Petovan f71a5b20e5
Merge pull request #11995 from annando/quote-uri-id
New field "quote-uri-id" for quoted posts
2022-10-15 08:51:24 -04:00
Tobias Diekershoff f862d73f49 added PHP GMP module to the installation section of the Vagrant VM provision 2022-10-15 09:25:11 +02:00
Michael 34c3f189fc Updated database.sql and messages.po 2022-10-14 22:48:03 +00:00
Roland Häder 1f9fc13d03
Rewrites:
From:
````
<?php
$arr = [];
$arr['foo'] = "FOO";
````

To:
````
<?php
$arr['foo'] = "FOO";
````
2022-10-15 00:44:37 +02:00
Roland Häder ebf3b7e62d
Changes:
- Content\Item versus Model\Item solved (?)
2022-10-15 00:44:07 +02:00
Roland Häder 85ed0742cf
Fixed:
- Content\Item versus Model\Item is really confusing!
2022-10-15 00:44:07 +02:00
Roland Häder 8f92d1cc8e
Changes:
- unified class import, we had these both:

````
use Friendica\Model\Item as ModelItem;
use Friendica\Object\Post as PostObject;
````

In first version the namespace was prefixing class name, in second suffixing it.
2022-10-15 00:44:07 +02:00
Roland Häder da66730e4f
Rewrite:
- moved constants GRAVITY_* from boot.php to Friendica\Model\Item
- also rewrote some array initialization:

From:
````
<?php
$arr = [];
$arr['foo'] = "FOO";
````

To:
````
<?php
$arr['foo'] = "FOO";
````
- added a few type-hints
2022-10-15 00:44:06 +02:00
Michael 1cf66ba0cc Merge remote-tracking branch 'upstream/develop' into quote-uri-id 2022-10-14 22:03:32 +00:00
Michael 3e868416c7 Check for post existence 2022-10-14 22:02:25 +00:00
Michael 88aceeb27f Merge remote-tracking branch 'upstream/2022.09-rc' into quote-uri-id 2022-10-14 19:11:15 +00:00
Tobias Diekershoff e5ae5c7e67 renewed the expiration date for the security.txt file 2022-10-14 20:54:05 +02:00
Tobias Diekershoff 5a800e2d09 prepare the CHANGELOG for 2022.12 2022-10-14 20:52:58 +02:00
Tobias Diekershoff b5d3651f3f bump version to 2022.12-dev 2022-10-14 20:52:38 +02:00
Tobias Diekershoff 7109d2a6a8 Friendica version 2022.10 2022-10-14 20:49:17 +02:00
Tobias Diekershoff 99b09858d2 set the release date for the 2022.10 release in the CHANGELOG 2022-10-14 20:48:08 +02:00
Tobias Diekershoff d989602c1c
Merge pull request #11913 from tobiasd/2022.09-CHANGELOG
Updates for the CHANGELOG for 2022.09
2022-10-14 20:40:31 +02:00
Tobias Diekershoff 1fd9558e60
Merge pull request #11990 from annando/share-feed
Return the pageinfo when feed is shared
2022-10-14 08:01:09 +02:00
Michael c2e57c5c0e Return the pageinfo when feed is shared 2022-10-14 04:43:46 +00:00
Tobias Diekershoff 8936ae26fd added fix for quoted shares from Twitter to the CHANGELOG 2022-10-13 09:53:58 +02:00
Philipp 1cc3fa6d77
Merge pull request #11989 from annando/quote-again
Only add images for non-federated quote shares
2022-10-12 08:27:17 +02:00
Michael da2afbeae3 Merge remote-tracking branch 'upstream/2022.09-rc' into quote-again 2022-10-12 05:36:00 +00:00
Michael e69b04d2df Only add the media for non federated posts 2022-10-12 05:34:55 +00:00
Michael Vogel b1364a2327
Merge pull request #11988 from MrPetovan/bug/notices
Add missing post keys to retrieve pLink in Model\Event::prepareListForTemplate()
2022-10-12 07:26:15 +02:00
Hypolite Petovan 0480d9aebd Add missing post keys to retrieve pLink in Model\Event::prepareListForTemplate()
- Address https://github.com/friendica/friendica/issues/11632#issuecomment-1275117722
2022-10-11 22:18:52 -04:00
Hypolite Petovan ec9059c395
Merge pull request #11987 from annando/quoted-media
Fix attached media in quoted posts
2022-10-11 19:54:44 -04:00
Michael 0e82f64d71 Only attach images 2022-10-11 21:39:28 +00:00
Michael f1f13db24f Simplified code 2022-10-11 20:48:47 +00:00
Michael 68d6e11d83 Fix attached media in quoted posts 2022-10-11 20:10:39 +00:00
Philipp 04564f0320
Merge pull request #11983 from MrPetovan/bug/fatal-errors
Contact array can be empty in Model\Contact::getAvatarPath
2022-10-11 17:52:17 +02:00
Hypolite Petovan 9e74a1bd06 Contact array can be empty in Model\Contact::getAvatarPath
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1274195844
2022-10-11 08:26:00 -04:00
Michael a67a364b91 Merge remote-tracking branch 'upstream/2022.09-rc' into quote-uri-id 2022-10-11 05:19:21 +00:00
Hypolite Petovan ec1da90094
Merge pull request #11982 from annando/fix-quote
Quoted posts from Twitter now contain media again
2022-10-10 21:53:19 -04:00
Michael 747139d186 Quoted posts from Twitter now contain media again 2022-10-10 23:18:58 +00:00
Michael aeb4645ba6 New field "quote-uri-id" for quoted posts 2022-10-10 22:39:30 +00:00
Hypolite Petovan 0b0567081a
Merge pull request #11981 from annando/better-quote
Quote of quotes are visually improved
2022-10-10 09:46:47 -04:00
Michael 028de0e228 Quote of quotes are visually improved 2022-10-10 12:30:07 +00:00
Tobias Diekershoff c8406f6cd0
Merge pull request #11980 from annando/cooldown
Use "maxloadavg" when "worker_load_cooldown" is not defined
2022-10-10 12:17:45 +02:00
Michael a21c04d55d Use "maxloadavg" when "worker_load_cooldown" is not defined 2022-10-10 06:01:07 +00:00
Tobias Diekershoff 7e8c48a539 added new API endpoint for events to the CHANGELOG 2022-10-10 07:57:12 +02:00
Tobias Diekershoff 656e74605f typo 2022-10-10 07:36:43 +02:00
Hypolite Petovan a10f55bb85
Merge pull request #11979 from annando/issue-11853
Notices
2022-10-09 17:45:33 -04:00
Hypolite Petovan 424dad886f
Merge pull request #11978 from annando/quote-simplified
The quote functionality is simplified
2022-10-09 17:26:22 -04:00
Michael 0d3aa681b4 The quote functionality is simplified 2022-10-09 21:16:36 +00:00
Michael Vogel 2b03edd59e
Merge pull request #11977 from MrPetovan/bug/11938-exotic-date-time-formats
Add a couple new cases to DateTimeFormat::fix()
2022-10-09 17:16:01 +02:00
Tobias Diekershoff b56a9cf419 some updates for the CHANGELOG 2022-10-09 16:01:02 +02:00
Hypolite Petovan a4b0ebf160 Add a couple of cases to DateTimeFormat::fix()
- Reworked method to perform more string replacements and fewer regular expression matches
2022-10-09 09:34:38 -04:00
Hypolite Petovan bee6506d33 Only call DateTimeFormat::fix() when there's an Exception
- This prevents valid date/time strings to be mangled by fix()
2022-10-09 09:34:30 -04:00
Michael Vogel b5ad8c3e15
Merge pull request #11973 from MrPetovan/task/test-fixDateFormat
Add tests for DateTimeFormat::fix()
2022-10-08 17:11:10 +02:00
Hypolite Petovan a36ea64bb4
Merge pull request #11976 from annando/issue-11975
Issue 11975: Don't call the postupdate if the table is missing
2022-10-08 10:48:57 -04:00
Michael 4552d36373 Issue 11975: Don't call the postupdate if the table is missing 2022-10-08 14:42:11 +00:00
Hypolite Petovan 47dd19ab95
Merge pull request #11974 from annando/issue-11969
Issue 11969: Simplified share
2022-10-08 10:04:07 -04:00
Michael 4a37c978c2 Issue 11969: Simplified share 2022-10-08 09:36:35 +00:00
Hypolite Petovan 345d307ae0 Add tests for DateTimeFormat::fix() 2022-10-07 23:10:50 -04:00
Hypolite Petovan c0447ced48 Simplify method name for DateTimeFormat::fix 2022-10-07 23:10:50 -04:00
Hypolite Petovan 9d2edcf0e1
Merge pull request #11972 from annando/issue-11969
Issue 11969: Only use the simple share with federated posts
2022-10-07 17:35:26 -04:00
Michael Vogel 49c5d62530
Merge pull request #11970 from MrPetovan/bug/marcor-newapi
Fix parameter names before being passed to Model\Event::store
2022-10-07 23:32:21 +02:00
Hypolite Petovan 2cbc11403e Fix parameter names before being passed to Model\Event::store
- Partial revert of 946db2ab45
2022-10-07 17:20:22 -04:00
Michael b92e23273d Only use http links 2022-10-07 21:17:39 +00:00
Michael d646d4eb1d Issue 11969: Only use the simple share with federated posts 2022-10-07 21:09:15 +00:00
Hypolite Petovan 616c4695f4
Merge pull request #11971 from annando/dateformat
And another weird date format
2022-10-07 17:04:12 -04:00
Michael 1ddeaaad4a And another weird date format 2022-10-07 19:56:02 +00:00
Hypolite Petovan 885f90afa3
Merge pull request #11967 from annando/quote-share
Improve quote share ("message_id" added)
2022-10-07 08:00:31 -04:00
Michael 33d48f7d55 Use trim 2022-10-07 08:14:04 +00:00
Michael ee03e4de08 Fix test 2022-10-07 08:13:26 +00:00
Michael a07fd7d7c2 Spaces to tabs 2022-10-07 08:07:12 +00:00
Michael f340fc6efa Harmonized regular expression 2022-10-07 08:00:09 +00:00
Michael 21bd2a8396 More whitespace 2022-10-07 07:57:20 +00:00
Michael f8d4ab1830 Whitespace removed 2022-10-07 07:55:44 +00:00
Michael ef934db614 Moved the share interpretation 2022-10-07 07:41:03 +00:00
Michael 1ef5730d3d "share" added to autocomplete 2022-10-07 05:54:17 +00:00
Michael d7a9745ffd Simplified share element 2022-10-07 05:51:36 +00:00
Tobias Diekershoff 71cc10835f
Merge pull request #11968 from MrPetovan/bug/11943-frio-left-sidebar-button-mobile
[frio] Add left sidebar toggle button for mobile anonymous view
2022-10-07 07:40:25 +02:00
Michael 8e9acfe210 Fix tests? 2022-10-07 05:22:10 +00:00
Hypolite Petovan 1422e8a510 [frio] Add left sidebar toggle button for mobile anonymous view
- It was missing from the anonymous top bar
2022-10-06 18:00:43 -04:00
Michael 48182a95fb Improve quote share ("message_id" added) 2022-10-06 21:50:20 +00:00
Hypolite Petovan fe442683ef
Merge pull request #11966 from annando/date-correction
Juts another date format fix
2022-10-06 17:39:44 -04:00
Michael 6b917718fd Juts another date format fix 2022-10-06 21:09:52 +00:00
Tobias Diekershoff b0d0d98a14
Merge pull request #11965 from annando/akkoma
Akkoma is added to the federation statistics
2022-10-06 08:33:59 +02:00
Michael 4c8a58c445 Akkoma is added to the federation statistics 2022-10-06 04:57:43 +00:00
Hypolite Petovan e840166d7d
Merge pull request #11964 from annando/dfrn-issharing
Added sharing check for DFRN
2022-10-05 18:28:09 -04:00
Michael f9b7f3acdb Added sharing check for DFRN 2022-10-05 21:11:09 +00:00
Hypolite Petovan b84f2b471a
Merge pull request #11961 from tobiasd/2022.09-credits
regen CREDITS for the next release
2022-10-04 11:37:12 -04:00
Tobias Diekershoff 964d54ee45 regen CREDITS for the next release 2022-10-04 17:28:08 +02:00
Hypolite Petovan fa3f5d8d9c
Merge pull request #11960 from annando/issue-11880
Issue 11880: Provide "alt" description from uploaded file
2022-10-03 19:10:00 -04:00
Michael 4d39ec8b63 Issue 11880: Provide "alt" description from uploaded file 2022-10-03 21:23:04 +00:00
Philipp e1bf708552
Merge pull request #11959 from annando/notice
Fix: Undefined array key "object_object_type"
2022-10-03 22:21:18 +02:00
Michael bde7283b04 Fix: Undefined array key "object_object_type" 2022-10-03 20:01:28 +00:00
Hypolite Petovan 241bd47896
Merge pull request #11958 from annando/issue-11938
Issue 11938: Fix weird date formats
2022-10-03 13:47:27 -04:00
Michael Vogel 0a7c9c66b5
Update src/Util/DateTimeFormat.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-10-03 19:04:49 +02:00
Michael 045238070b Issue 11938: Fix weird date formats 2022-10-03 16:12:22 +00:00
Hypolite Petovan 168827c8ae
Merge pull request #11957 from annando/issue-11891
Issue 11891: Enable search for user@domain.tld
2022-10-03 11:15:55 -04:00
Michael 4b8c631216 Issue 11891: Enable search for user@domain.tld 2022-10-03 13:53:19 +00:00
Hypolite Petovan 3895da3618
Merge pull request #11956 from annando/issue-11952
Issue 11952: Avoid to send AP related comments to Diaspora
2022-10-03 09:20:37 -04:00
Michael 8347f0144b Fix log message 2022-10-03 11:42:50 +00:00
Michael 5127784acb Recursively check if the thread supports Diaspora 2022-10-03 11:04:57 +00:00
Michael 7395ae22f7 Issue 11952: Avoid to send AP related comments to Diaspora 2022-10-03 10:40:16 +00:00
Hypolite Petovan 38cf0666bd
Merge pull request #11955 from annando/issue-11953
Fix picture link removal in "getAttachedData"
2022-10-02 21:35:30 -04:00
Michael 1afbcb2486 Added description 2022-10-02 23:55:33 +00:00
Michael bf4c5ba84f Improved URL handling 2022-10-02 20:42:21 +00:00
Hypolite Petovan 844ed720b2
Merge pull request #11948 from annando/transmit-quote
Support for transmitting quoted posts
2022-10-02 12:14:19 -04:00
Michael 0de458e134 Case changed 2022-10-02 04:51:00 +00:00
Michael 1612715626 Merge remote-tracking branch 'upstream/2022.09-rc' into issue-11953 2022-10-01 23:02:55 +00:00
Michael 6fb5e13b08 Add ♲ symbol 2022-10-01 22:36:02 +00:00
Michael 8d9cb974af Merge remote-tracking branch 'upstream/2022.09-rc' into transmit-quote 2022-10-01 22:30:44 +00:00
Michael 54d25ebc91 Fix picture link removal in "getAttachedData" 2022-10-01 22:26:37 +00:00
Hypolite Petovan 034f0ec1e4
Merge pull request #11954 from annando/issue-11953
Issue 11953: Split a message in parts
2022-10-01 15:49:21 -04:00
Michael 1e29c6f705 Ensure not to add the plink 2022-10-01 16:54:11 +00:00
Michael 2d6735a616 Issue 11953: Split a message in parts 2022-10-01 16:37:32 +00:00
Michael 8eb4ab2a33 Added comment for the deactivated part 2022-09-30 07:17:07 +00:00
Michael d43b85e94b Don't transmit the shared attachments 2022-09-30 07:10:43 +00:00
Michael 59004711ec Support for transmitting quoted posts 2022-09-29 22:29:15 +00:00
Hypolite Petovan 1edcd65e0e
Merge pull request #11947 from annando/ap-quote
Support for quoted links is added
2022-09-29 12:20:46 -04:00
Michael a653c6350d Support for quoted links is added 2022-09-29 16:04:33 +00:00
Hypolite Petovan c0e009ac6f
Merge pull request #11946 from annando/non-follower-content
Additional checks for non follower content
2022-09-29 11:34:43 -04:00
Hypolite Petovan 39bc4a5881
Merge pull request #11945 from tobiasd/20220929-fr
FR translation update THX Nicolas Derive
2022-09-29 11:21:59 -04:00
Michael 9587787089 Add uri as well 2022-09-29 14:13:39 +00:00
Michael 6140f850e1 Detect the thread parent id if it is missing 2022-09-29 13:48:10 +00:00
Michael ff80a25966 Additional checks for non follower content 2022-09-29 12:45:47 +00:00
Tobias Diekershoff 560f061380 FR translation update THX Nicolas Derive 2022-09-29 14:26:01 +02:00
Hypolite Petovan 89cc704b8a
Merge pull request #11944 from annando/follow-object
Added logging of unexpected follow messages
2022-09-28 14:35:56 -04:00
Michael b10496f4e9 Changed log level 2022-09-28 16:45:18 +00:00
Michael d821afb418 Added logging of unexpected follow messages 2022-09-28 16:32:17 +00:00
Hypolite Petovan fa71ec462b
Merge pull request #11942 from annando/contact-posts
Only display reshared thread starting posts
2022-09-28 05:55:10 -04:00
Michael c65f78e579 Only display reshared thread starting posts 2022-09-28 09:48:48 +00:00
Hypolite Petovan c12ac42695
Merge pull request #11940 from annando/issue-11876
Issue 11876: Fix local message distribution
2022-09-27 12:07:30 -04:00
Michael 2def5e9f02 Issue 11876: Fix local message distribution 2022-09-27 15:58:16 +00:00
Hypolite Petovan 38096ce4cb
Merge pull request #11939 from nupplaphil/bug/l10n
Minor l10n issue
2022-09-27 11:20:37 -04:00
Philipp 0ce7b49cb3
Minor l10n issue 2022-09-27 10:52:17 +02:00
Hypolite Petovan 57a98c45f1
Merge pull request #11921 from annando/worker-timeout
We can now configure the worker runtime limits
2022-09-26 10:51:46 -04:00
Michael 4c52772d84 Use class constant 2022-09-26 13:33:31 +00:00
Michael 5e51ab95fb Merge remote-tracking branch 'upstream/2022.09-rc' into worker-timeout 2022-09-26 13:26:56 +00:00
Hypolite Petovan afac91fa34
Merge pull request #11936 from annando/youtube-shorts
Added support for the "Youtube Shorts" URL
2022-09-26 07:33:23 -04:00
Hypolite Petovan e56e543a79
Merge pull request #11933 from nupplaphil/bug/module_returns
Fix /api/v1/push/subscription
2022-09-26 07:32:24 -04:00
Philipp d80646ccc7
Merge pull request #11935 from annando/issue-11932
Issue 11932: Restore SQL performance
2022-09-26 13:23:54 +02:00
Michael 297ddbb8c8 Added support for the "Youtube Shorts" URL 2022-09-26 07:04:35 +00:00
Michael 63ec808fb9 Issue 11932: Restore SQL performance 2022-09-26 06:39:28 +00:00
Philipp 883a2ee71b
Update src/Module/Api/Mastodon/PushSubscription.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-09-26 07:25:04 +02:00
Philipp 5c88813775
Update src/Module/Api/Mastodon/PushSubscription.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-09-26 07:24:55 +02:00
Philipp 2d4598a4db
adapt return type 2022-09-25 23:17:37 +02:00
Philipp 60b1cac166
Add empty testcase for later .. would work if we could mock applications 2022-09-25 21:39:29 +02:00
Philipp 006dbcf4ce
some code-beautification 2022-09-25 21:39:29 +02:00
Philipp ad62265d08
Fix /api/v1/push/subscription 2022-09-25 21:39:28 +02:00
Hypolite Petovan e83dfab6cd
Merge pull request #11929 from annando/issue-11919
Issue 11919: Avoid possible memory problems
2022-09-25 08:48:56 -04:00
Michael 22ed028ba1 Simplified structure 2022-09-25 07:12:05 +00:00
Michael e584185c0a Updated messages.po 2022-09-25 07:09:22 +00:00
Michael 662c846402 Issue 11919: Avoid possible memory problems 2022-09-25 06:34:13 +00:00
Michael Vogel 81f7feabc6
Merge pull request #11928 from MrPetovan/bug/11851-content-0
Fix removing falsy text nodes in HTML::tagToBBCodeSub
2022-09-25 07:28:54 +02:00
Hypolite Petovan 3e1b6890b7 Fix removing falsy text nodes in HTML::tagToBBCodeSub
- This wrongly removed text nodes containing just '0'
2022-09-24 22:03:49 -04:00
Hypolite Petovan df559a24c0
Merge pull request #11927 from annando/missing-uri-id
Add the uri-id if missing
2022-09-24 18:33:23 -04:00
Michael bca9069b22 Add the uri-id if missing 2022-09-24 21:53:27 +00:00
Michael Vogel 08ead52433
Merge pull request #11763 from tobiasd/marcor-newapi
new event APIs
2022-09-24 21:18:20 +02:00
Hypolite Petovan 5a236e0af2
Merge pull request #11925 from mexon/mat/dont-remove-slash
Do not remove trailing slash from URIs
2022-09-24 15:05:02 -04:00
Hypolite Petovan 02e9a867ae
Merge pull request #11926 from annando/sql-queries
(Hopefully) SQL improvements
2022-09-24 15:01:34 -04:00
Hypolite Petovan 080aa55302
Merge pull request #11924 from annando/error
Fix error "Class 'Friendica\Worker\Worker' not found"
2022-09-24 14:59:58 -04:00
Michael Vogel b00947025a
Merge pull request #11922 from MrPetovan/bug/notices
Ward against missing keys in Model\APContact::isRelay
2022-09-24 20:02:21 +02:00
Michael Vogel 260310e878
Merge pull request #11923 from MrPetovan/bug/fatal-errors
Check for network key existence before calling Probe::isProbable in Model\Contact
2022-09-24 20:01:17 +02:00
Michael 3911c9450b (Hopefully) SQL improvements 2022-09-24 17:56:07 +00:00
Michael bd817d2391 Fix error "Class 'Friendica\Worker\Worker' not found" 2022-09-24 17:29:00 +00:00
Matthew Exon 7613433357 Do not remove trailing slash from URIs 2022-09-24 17:57:28 +02:00
Hypolite Petovan 6ca725e5b6 Check for network key existence before calling Probe::isProbable in Model\Contact
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1253225607
2022-09-24 10:18:41 -04:00
Hypolite Petovan ded5a0ac6a Ward against missing keys in Model\APContact::isRelay
- Address https://github.com/friendica/friendica/issues/11632#issuecomment-1231904280
2022-09-24 09:56:12 -04:00
Michael Vogel 98a4c7a56c We can now configure the worker runtime limits 2022-09-24 10:00:41 +02:00
Hypolite Petovan be9bbe1709
Merge pull request #11917 from annando/cooldown
More cooldown calls for worker processes
2022-09-22 22:39:04 -04:00
Michael 97e5477bde static cooldown moved to the cooldown function 2022-09-22 22:46:59 +00:00
Hypolite Petovan 264b8f27fd
Merge pull request #11918 from annando/fcontact
Worker for updating fcontact entries
2022-09-22 11:00:15 -04:00
Michael e1341b6ad3 Fallback for load detection, additional checks 2022-09-22 05:45:42 +00:00
Michael 30eb511da3 Reverting changes 2022-09-22 04:33:00 +00:00
Michael 4939be065e Merge remote-tracking branch 'upstream/2022.09-rc' into cooldown 2022-09-22 04:31:50 +00:00
Hypolite Petovan 6a9d91c824
Merge pull request #11902 from annando/duplicates
Detect and remove contact duplicates
2022-09-21 21:23:37 -04:00
Michael Vogel c87150819b Worker for updating fcontact entries 2022-09-21 22:47:09 +02:00
Michael Vogel f7d054674d Don't perform a cooldown in the daemon by now 2022-09-21 22:44:48 +02:00
Michael Vogel 0fa281247d More cooldown calls for worker processes 2022-09-21 21:03:07 +02:00
Tobias Diekershoff 3f3e1a2bf4
Merge pull request #11914 from annando/forum-delivery
Fix forum delivery in case of being addressed via "@"
2022-09-21 11:07:00 +02:00
Michael Vogel 6ee8a966bf Fix forum delivery in case of beiong addressed via "@" 2022-09-21 10:54:05 +02:00
Tobias Diekershoff 94cd729cca Updates for the CHANGELOG for 2022.09 2022-09-21 09:46:24 +02:00
Michael 36668dfdb1 Merge remote-tracking branch 'upstream/2022.09-rc' into duplicates 2022-09-21 03:46:25 +00:00
Hypolite Petovan 4deee0932c
Merge pull request #11910 from annando/logging
Improved page rendering speed logging
2022-09-20 21:05:58 -04:00
Hypolite Petovan ddfc0f2cd9
Merge pull request #11908 from annando/relay-languages
Allow to reject specific languages on receiving posts via the relay
2022-09-20 21:04:58 -04:00
Michael Vogel 7ae500f28d Improved page rendering speed logging 2022-09-20 16:30:56 +02:00
Michael Vogel d55a5cd17b Changed documentation 2022-09-20 06:09:17 +02:00
Michael Vogel 199d8bbf35 Merge remote-tracking branch 'upstream/2022.09-rc' into relay-languages 2022-09-20 06:05:15 +02:00
Hypolite Petovan 0747eb4961
Merge pull request #11905 from annando/fcontact-noscrape
The fcontact table is now updated in the background to improve performance
2022-09-19 09:10:32 -04:00
Michael Vogel 6ba2c4bb01 Added documentation 2022-09-19 12:49:37 +02:00
Michael Vogel 3650feb256 "Count" parameter added 2022-09-19 12:46:28 +02:00
Michael Vogel f08b08e0d8 Allow to reject specific languages on receiving posts via the relay 2022-09-19 12:36:12 +02:00
Michael Vogel 2525b3f2ae
Update src/Network/Probe.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2022-09-19 07:52:40 +02:00
Michael Vogel e5c24f33f0 The fcontact table is now updated in the background to improve performance 2022-09-18 15:40:44 +02:00
Philipp 3ec9d51ec8
Merge pull request #11904 from MrPetovan/task/composer
[Composer] Update dependencies ahead of 2022.09 release
2022-09-18 11:26:06 +02:00
Hypolite Petovan 3043ef4192 [Composer] Update dependencies ahead of 2022.09 release
- Updating bacon/bacon-qr-code (2.0.4 => 2.0.7)
- Updating ezyang/htmlpurifier (v4.13.0 => v4.14.0)
- Updating guzzlehttp/psr7 (1.8.3 => 1.9.0)
- Updating guzzlehttp/promises (1.5.1 => 1.5.2)
- Updating symfony/polyfill-php72 (v1.23.0 => v1.26.0)
- Updating symfony/polyfill-intl-normalizer (v1.23.0 => v1.26.0)
- Updating symfony/polyfill-intl-idn (v1.23.0 => v1.26.0)
- Updating guzzlehttp/guzzle (6.5.5 => 6.5.8)
- Updating mobiledetect/mobiledetectlib (2.8.37 => 2.8.39)
- Updating monolog/monolog (1.26.1 => 1.27.1)
- Updating phpseclib/phpseclib (2.0.35 => 2.0.38)
- Updating smarty/smarty (v4.1.0 => v4.2.1)
- Updating bower-asset/vue (v2.6.14 => v2.7.10)
- Updating npm-asset/moment (2.29.1 => 2.29.4)
- Updating paragonie/constant_time_encoding (v2.4.0 => v2.6.3)
- Updating paragonie/sodium_compat (v1.17.0 => v1.18.0)
- Updating fgrosse/phpasn1 (v2.3.0 => v2.4.0)
- Updating composer/ca-bundle (1.3.1 => 1.3.3)
2022-09-17 23:38:11 -04:00
Michael 79b64cc44f Detect and remove contact duplicates 2022-09-16 05:00:06 +00:00
Hypolite Petovan 636325efcc
Merge pull request #11899 from annando/native-xml
Template based XML generation is replaced with native XML
2022-09-11 04:39:39 -04:00
Philipp 7c64ab890a
Merge pull request #11888 from MrPetovan/bug/11861-frio-filerm
[frio] Add support for asynchronous call to /filerm module for post categories and folders
2022-09-11 10:35:34 +02:00
Hypolite Petovan 6db79aa741 Updated main translation file after moving strings 2022-09-11 03:35:14 -04:00
Michael ff89c1a8bf Template based XML generation is replaced with native XML 2022-09-11 07:00:16 +00:00
Hypolite Petovan 60d1779717 [frio] Add support for asynchronous call to /filerm module for post categories and folders
- This prevents the page to change to an empty page when clicking on the remove link of categories and folders
2022-09-11 02:36:06 -04:00
Hypolite Petovan cacfc6ec92 Enable POST route for /filerm module
- This prevents a costly page empty page render when calling the module asynchronously
2022-09-11 02:36:06 -04:00
Hypolite Petovan bdd80eeaaf Fix wrong parameter name in Core\System::httpExit 2022-09-11 02:36:05 -04:00
Philipp 77798482cb
Merge pull request #11898 from tobiasd/20220911-hu
HU translation updates THX Balázs Úr
2022-09-11 08:31:29 +02:00
Tobias Diekershoff 9d6e4d7483 HU translation updates THX Balázs Úr 2022-09-11 08:19:20 +02:00
Philipp 2123b4d071
Merge pull request #11895 from annando/smarty-sub-dir
Smarty: Configuration added to store without sub directories
2022-09-09 08:20:04 +02:00
Michael 63e1ad7dba Read the config at another place 2022-09-08 06:21:16 +00:00
Michael ff677a1b27 Smarty: Configuration added to store without sub directories 2022-09-08 05:10:26 +00:00
Hypolite Petovan 7da43fe28a
Merge pull request #11892 from annando/pagecache
Pagecache for frequently fetched pages
2022-09-07 22:25:19 -04:00
Michael 8b41783aaa Changed database version 2022-09-07 19:47:59 +00:00
Michael a0b99f61ea Use the cached activity function 2022-09-07 19:46:24 +00:00
Hypolite Petovan f762a38dbb
Merge pull request #11894 from annando/issue-11893-a
Issue 11893: Postupdate to fix wrong parents
2022-09-06 19:40:37 -04:00
Michael 0121c2845a Test stuff removed 2022-09-06 22:56:56 +00:00
Michael da658cbf1d Delete the cache entry when the post is changed or deleted 2022-09-06 21:51:47 +00:00
Michael d7212cbbbc Function only needn't to be public 2022-09-06 20:47:18 +00:00
Michael ec8377a8c7 Issue 11893: Postupdate to fix wrong parents 2022-09-06 20:00:06 +00:00
Michael 7c9f10e58f Merge remote-tracking branch 'upstream/2022.09-rc' into pagecache 2022-09-06 17:36:42 +00:00
Philipp f0622163b2
Merge pull request #11893 from annando/issue-11890
Issue 11890: Don't use empty contexts
2022-09-06 18:24:36 +02:00
Michael 2a4c6d44bb Don't transmit empty conversations 2022-09-06 15:18:41 +00:00
Michael f0d151932e Issue 11890: Don't use empty contexts 2022-09-06 14:08:25 +00:00
Michael 6eb9dff807 Pagecache for frequently fetched pages 2022-09-06 06:04:41 +00:00
Hypolite Petovan 934a3a6721
Merge pull request #11887 from annando/maxload
Pause the worker execution when the load is too high
2022-09-04 15:54:40 -04:00
Hypolite Petovan 8f283985f0
Merge pull request #11884 from annando/language
Improved language detection
2022-09-04 15:52:29 -04:00
Hypolite Petovan acaa15b6fb
Merge pull request #11886 from annando/database
All URL fields are now binary and longer
2022-09-04 15:48:41 -04:00
Michael e2cb705468 Merge remote-tracking branch 'upstream/2022.09-rc' into language 2022-09-04 17:04:13 +00:00
Michael 437c230a6f Merge remote-tracking branch 'upstream/2022.09-rc' into database 2022-09-04 17:03:14 +00:00
Michael 96ae2c8f56 Merge remote-tracking branch 'upstream/2022.09-rc' into maxload 2022-09-04 17:01:35 +00:00
Philipp 2ad587faf4
Merge pull request #11883 from annando/performance
Use AP data when possible
2022-09-04 18:22:07 +02:00
Michael f5d6671fbd Merge remote-tracking branch 'upstream/2022.09-rc' into performance 2022-09-04 14:08:16 +00:00
Michael 12d4bae28f Merge remote-tracking branch 'upstream/2022.09-rc' into language 2022-09-04 14:05:46 +00:00
Michael 075638c0ae Pause the worker execution when the load is too high 2022-09-04 13:54:32 +00:00
Michael f93418b295 Merge remote-tracking branch 'upstream/2022.09-rc' into database 2022-09-04 13:41:21 +00:00
Tobias Diekershoff da655f5159
Merge pull request #11885 from annando/tolerant-receiver
Be more tolerant when receiving messages
2022-09-04 15:11:43 +02:00
Michael c3d478aeed Improved logger calls 2022-09-04 09:22:15 +00:00
Michael 7c756a3bcb Updated database.sql and messages.po 2022-09-04 08:08:50 +00:00
Michael 767883476f Updated database.sql and messages.po 2022-09-04 08:06:32 +00:00
Michael b0326afae3 Updated database.sql and messages.po 2022-09-04 08:03:56 +00:00
Michael 144547009b All URL fields are now binary and longer 2022-09-04 07:54:01 +00:00
Michael de2d486e95 Merge remote-tracking branch 'upstream/2022.09-rc' into performance 2022-09-04 07:45:24 +00:00
Michael f22a4ba6f5 Be more tolerant when receiving messages 2022-09-04 07:39:09 +00:00
Michael 4304aa9eec Improved language detection 2022-09-04 07:32:46 +00:00
Michael 9f2d3e6f88 Use AP data when possible 2022-09-04 07:15:04 +00:00
Tobias Diekershoff dd59ad9032 Switching to 2022.09-rc 2022-09-04 08:49:18 +02:00
Tobias Diekershoff 6557efd786
Merge pull request #11882 from annando/warnings
Fix logger warnings/errors
2022-09-04 07:31:25 +02:00
Michael f7be610629 Fix logger warmings/errors 2022-09-03 13:32:41 +00:00
Hypolite Petovan 93acaff014
Merge pull request #11879 from annando/receive-reshare
Fix receiving of reshared posts
2022-08-31 21:55:04 -04:00
Michael 3e28d62bdb Fix receiving of reshared posts 2022-08-31 21:18:33 +00:00
Philipp 2a2e1a9e12
Merge pull request #11877 from annando/log-levels
Loglevels are adjusted
2022-08-31 21:52:59 +02:00
Michael cc43b567cb Some changes after code review 2022-08-31 19:03:37 +00:00
Michael 9ca470cc94 Reverted experimental change 2022-08-31 05:02:28 +00:00
Michael f7b85092b0 Some more changed log levels 2022-08-31 05:01:22 +00:00
Michael 757a5c2de9 Loglevels are adjusted 2022-08-30 19:45:30 +00:00
Hypolite Petovan 312e4d8844
Merge pull request #11872 from annando/warnings
Some more warnings and errors are fixed
2022-08-28 16:55:54 -04:00
Michael 3a840aa22d Some more warnings and erors are fixed 2022-08-28 19:27:21 +00:00
Philipp b8a1014a90
Merge pull request #11871 from annando/issue-11870
Issue 11870: Weeks can now start at every day
2022-08-28 13:09:54 +02:00
Michael 61cbcf85a1 Issue 11870: Weeks can now start at every day 2022-08-28 09:15:00 +00:00
Michael 3052ae71b7 Avoid warnings 2022-08-28 09:12:36 +00:00
Michael 4e02c347b6 Handle array 2022-08-28 04:14:39 +00:00
Hypolite Petovan 45729f0107
Merge pull request #11869 from annando/issue-11853
Issue 11853/11867: Fix reshare of public posts
2022-08-28 00:12:51 -04:00
Michael d54cf9cc21 Avoid warnings/fatal errors 2022-08-28 04:00:18 +00:00
Michael 2173fb38e0 Issue 11853/11867: Fix reshare of public posts 2022-08-27 21:22:49 +00:00
Hypolite Petovan 1e4e7d5b58
Merge pull request #11866 from annando/database2
Warnings/Errors reduces - relay processing improved
2022-08-27 08:40:53 -04:00
Michael a0eaff8fd5 Fix issue 11865 2022-08-27 11:43:46 +00:00
Michael ceb88c10e6 Warnings/Errors reduced - improved relay processing 2022-08-27 08:08:58 +00:00
Michael 1db70b8935 Merge remote-tracking branch 'upstream/develop' into database2 2022-08-25 18:48:24 +00:00
Michael dd8279afc2 Some more protection against database errors 2022-08-25 18:47:07 +00:00
Tobias Diekershoff fde853897f
Merge pull request #11863 from annando/database
Avoid some database errors
2022-08-25 13:49:05 +02:00
Michael 15d975f143 Avoid some database errors 2022-08-25 04:57:41 +00:00
Philipp 453667023e
Merge pull request #11860 from tobiasd/20220824-fr
FR translation update
2022-08-24 08:16:26 +02:00
Tobias Diekershoff 97992cf1c6 FR translation update 2022-08-24 07:23:26 +02:00
Tobias Diekershoff aaaf928650
Merge pull request #11857 from annando/diaspora-author-signature
Diaspora: Don't check the author signature when author = parent author
2022-08-22 15:02:57 +02:00
Michael 4e3102bfb3 Diaspora: Don't check the author signature when author = parent author 2022-08-22 09:54:29 +00:00
Hypolite Petovan 2957a3def6
Merge pull request #11855 from annando/contact-id2
The contact-id of a wall posting is always the owner contact
2022-08-22 04:26:45 -04:00
Michael 2a0ca80630 The contact-id of a wall posting is always the owner contact 2022-08-22 07:54:48 +00:00
Philipp 17a394e23c
Merge pull request #11854 from MrPetovan/bug/fatal-errors
Ensure Util\Profiler->rendertime is bool
2022-08-21 14:11:05 +02:00
Hypolite Petovan 5f62a59d2f Ensure Util\Profiler->rendertime is bool
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1221228589
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1221244898
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1221333918
2022-08-21 07:44:12 -04:00
Philipp 59b4f2e993
Merge pull request #11852 from Quix0r/fixes/double-quotes-single
Fixes/double quotes single
2022-08-19 19:18:21 +02:00
Roland Häder 4c6940583a
Changes:
- added missing type-hints
- first access level, then static
- reformatted code following code-style
2022-08-19 19:12:30 +02:00
Roland Häder b3906326a4
Changed:
- changed double-quotes to single
- added some empty lines for better readability
2022-08-19 19:12:29 +02:00
Tobias Diekershoff d0a011f049
Merge pull request #11849 from annando/contact-id
Improved contact-id detection
2022-08-19 17:48:05 +02:00
Michael 51331ced9b Improved function to fetch the contact id 2022-08-18 10:13:46 +00:00
Michael a4f1df68e4 Improved contact-id detection 2022-08-18 07:48:39 +00:00
Hypolite Petovan 037b4b7928
Merge pull request #11847 from annando/storeforuser
Improved checks in "storeForUserByUriId" to reduce recursion depth
2022-08-17 17:55:27 -04:00
Michael 531085890a Fetch the parent only - thread parents only on reshares 2022-08-17 19:39:20 +00:00
Michael 6070221364 Improved checks in "storeForUserByUriId" to reduce recursion depth 2022-08-17 05:28:24 +00:00
Hypolite Petovan efa1344c64
Merge pull request #11845 from annando/performance
Several performance improvements
2022-08-16 07:40:46 -04:00
Michael 3e2c684319 Some more index / fatal erros fixed 2022-08-16 11:23:47 +00:00
Michael bb52e5a804 Cascade on author deletion 2022-08-16 04:18:29 +00:00
Michael 4d617c9c48 This cache key doesn't exist anymore 2022-08-15 18:46:10 +00:00
Michael 5b3145d7ce Several performance improvements 2022-08-15 13:23:01 +00:00
Hypolite Petovan 946db2ab45 Normalize start_time and end_time parameter names in Friendica API event endpoints 2022-08-13 23:28:20 -04:00
pankraz bd02340162 new event APIs 2022-08-13 23:28:19 -04:00
Philipp 9be09f7df5
Merge pull request #11844 from Quix0r/fixes/call-get-on-null
Fixed "get() on NULL", PHP is case-sensitive here
2022-08-13 23:27:37 +02:00
Roland Häder c1c37da545
Changed double-quotes to single 2022-08-13 23:24:38 +02:00
Roland Häder 52d1b9905e
Fixes:
- fixed "get() on NULL invocation, PHP is case-sensitive here
- renamed $this->baseurl to $this->baseUrl (instance) in MoveToAvatarCache to
  make it same as everywhere else
2022-08-13 22:47:57 +02:00
Hypolite Petovan 579758d8b1
Merge pull request #11843 from Quix0r/fixes/this-in-static-context
fixed $this usage (kept) and got rid of static context
2022-08-13 16:37:52 -04:00
Roland Häder f579d687a9
Fixes:
- fixed $this usage (kept) and got rid of static context
- "imported" exception class
- added some nice text to it
2022-08-13 22:32:56 +02:00
Hypolite Petovan 21f3a56c42
Merge pull request #11841 from Quix0r/cleanups/type-hints-documentation
Cleanups/type hints + documentation
2022-08-13 10:43:11 -04:00
Hypolite Petovan 23cf850198
Merge pull request #11842 from annando/update-contact
Improved performance when updating contacts
2022-08-13 10:42:39 -04:00
Michael c6de91a8ec Don't delete the post when there is some undeleted post-user 2022-08-13 12:24:25 +00:00
Roland Häder 88cdb695b1
Changed:
- double-quotes to single
- more space around concated strings
- removed TODO as there is sadly no IOException in PHP
2022-08-13 13:35:50 +02:00
Michael bc3a6b2bb7 Return value added 2022-08-13 10:14:16 +00:00
Michael 5c5ae00370 Improved performance when updating contacts 2022-08-13 09:01:48 +00:00
Roland Häder ff5673e2d8
Changed:
- used $this->baseurl instead of DI::baseurl() (@MrPetovan)
2022-08-13 06:52:09 +02:00
Roland Häder cfa575b8e5
Changes:
- added missing type-hints
- added documentation
- removed parameter $baseURL while it can be locally get the same way but
  lesser parameter
- used ActivityNamespace::SALMON_ME
- changed double-quotes to single
2022-08-12 14:01:40 +02:00
Roland Häder 074bae33c9
Changes:
- added some missing type-hints
- added some documentation
- added some empty lines to `@return` statements (code-style convention)
2022-08-12 13:36:34 +02:00
Roland Häder 33c7abd376
Changes:
- methods should ALWAYS start lower-case, not upper
- documented a bit more
2022-08-12 13:13:54 +02:00
Roland Häder 9794ce0c87
Changes:
- added type-hint for $type parameter
- documented method
- unsupported verbs logged
2022-08-12 13:09:59 +02:00
485 changed files with 17625 additions and 14886 deletions

View File

@ -1,10 +1,58 @@
Version 2022.09 (unreleased)
Version 2022.12 (unreleased)
Friendica Core
Friendica Addons
BREAKING: The functions from the boot.php file have been moved into better fitting classes
this may break your custom addons. See the pull requests #1293 and #1294 in the
addon repository about the needed changes to your addons.
Closed Issues
Version 2022.10 (2022-10-14)
Friendica Core
Added GD translation, updates to the translations AR, DE, FR, HU, PL, SV, ZH CN
Added a check for too long passwords (due Blowfish hashing algorithm) [MrPetovan]
Added an API endpoint to create events [MrPetovan, pankraz]
Added the possibility to store profile avatars in a separate directory [annando]
Added an option to not fetch parent postings [annando]
Added an option to reject postings by language received by the relay [annando]
Added a notification mail to all users when the server block list is updated [MrPetovan]
Added a download link to the CSV file of the server block list on the about page [MrPetovan]
Added support for youtube short URLs [annando]
Updates to the themes (frio, smoothly) [AlessandroLorenzi, HankG, MrPetovan, tobiasd]
General code cleanup [annando, fabrixxm, Quix0r, tobiasd]
Enhanced the performance (cache, database, rendering) [annando, Quix0r]
Enhanced the language detection [annando]
Enhanced the display of the reason why a posting is shown to a user [annando]
Enhanced the fetching of missing postings [annando]
Enhanced the server detection [annando]
Enhanced the UI for 2FA logins [nupplaphil]
Enhanced the Woodpecker integration [nupplaphil]
Enhanced integration with ejabberd [nupplaphil]
Fixed a federation problem with Diaspora* during the author signature check [annando]
Fixed a problem with Forwarded-For headers [nupplaphil]
Fixed a problem with the encoding of mails send [MrPetovan]
Fixed a problem with weird formatted date notations [annando, MrPetovan]
Fixed a problem following some RSS feeds [mexon]
Fixed a problem with quoted reshares from Twitter [annando]
Updated dependencies [MrPetovan]
Replace SFTP-publish with docker-publish [nupplaphil]
Removed the poke functionality [MrPetovan]
Friendica Addons
Added GD translation, updates to the translation AR, FR
Removed the addons: morechoice, morepokes
Marked the addon whindowsphonepush as unsupported
twitter:
Valid post body can be empty [MrPetovan]
Support of Twitter threads was added [annando]
Closed Issues
11177, 11317, 11458, 11471, 11566, 11614, 11625, 11635, 11636, 11638,
11651, 11661, 11666, 11695, 11700, 11704, 11706, 11708, 11712, 11716,
11722, 11723, 11724, 11726, 11731, 11732, 11751, 11765, 11775, 11778,
11779, 11794, 11798, 11799, 11800, 11824, 11826, 11851, 11861, 11870,
11909, 11920, 11931, 11938, 11943, 11952, 11953, 11969, 11975
Version 2022.06 (2022-06-11)
Friendica Core

View File

@ -10,6 +10,7 @@ Aditoo
AgnesElisa
Albert
Aleksandr "M.O.Z.G" Dikov
Alessandro Lorenzi
Alex
Alexander An
Alexander Fortin
@ -66,6 +67,7 @@ Christian Vogeley
Christian Wiwie
Cohan Robinson
Colby Sollars
Copiis
Copiis Praeesse
CrystalStiletto
Cyboulette
@ -120,6 +122,7 @@ Gregory Smith
gudzpoz
guzzisti
Haakon Meland Eriksen
Hank Grabowski
Hans Meine
Hauke
Hauke Altmann
@ -199,6 +202,7 @@ mpanhans
mytbk
nathilia-peirce
Nicola Spanti
Nicolas Derive
nobody
nupplaPhil
Olaf Conradi
@ -208,6 +212,7 @@ Olivier Mehani
Olivier Migeot
ominds
ozero dien
pankraz
Paolo Wave
Pascal
Pascal Deklerck
@ -310,6 +315,7 @@ Valvin
Vasudev Kamath
Vasya Novikov
very-ape
Viktor Nilsson
Vinzenz Vietzke
vislav
vladimir N
@ -318,8 +324,10 @@ VVelox
Vít Šesták 'v6ak'
Waldemar Stoczkowski
Walter Bulbazor
Wanting Chen
Wil Tur
Wouter Broers
Xiaofei Xu
XMPPはいいぞ
Yasen Pramatarov
Yasmine A

View File

@ -1,4 +1,4 @@
INPUT = README.md index.php boot.php update.php bin/ mod/ include/ view/ src/ VERSION
INPUT = README.md index.php update.php bin/ mod/ view/ src/ VERSION
RECURSIVE = YES
PROJECT_NAME = "Friendica"
PROJECT_LOGO = images/friendica-64.png

View File

@ -1 +1 @@
2022.09-dev
2022.12-dev

2
Vagrantfile vendored
View File

@ -1,5 +1,5 @@
server_ip = "192.168.22.10"
server_ip = "192.168.56.10"
server_memory = "2048" # MB
server_timezone = "UTC"

View File

@ -26,6 +26,7 @@ if (php_sapi_name() !== 'cli') {
}
use Dice\Dice;
use Friendica\DI;
use Psr\Log\LoggerInterface;
require dirname(__DIR__) . '/vendor/autoload.php';
@ -33,6 +34,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]);
/// @fixme Necessary until Hooks inside the Logger can get loaded without the DI-class
DI::init($dice);
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
(new Friendica\Core\Console($dice, $argv))->execute();

View File

@ -45,7 +45,7 @@ $longopts = ['foreground'];
$options = getopt($shortopts, $longopts);
// Ensure that daemon.php is executed from the base path of the installation
if (!file_exists('boot.php') && (sizeof($_SERVER['argv']) != 0)) {
if (!file_exists('index.php') && (sizeof($_SERVER['argv']) != 0)) {
$directory = dirname($_SERVER['argv'][0]);
if (substr($directory, 0, 1) != '/') {

View File

@ -45,13 +45,13 @@ apt-get install -qq apache2
a2enmod rewrite actions ssl
cp /vagrant/bin/dev/vagrant_vhost.sh /usr/local/bin/vhost
chmod guo+x /usr/local/bin/vhost
vhost -s 192.168.22.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
vhost -s 192.168.56.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
a2dissite 000-default
service apache2 restart
#Install php
echo ">>> Installing PHP7"
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip php-gmp
systemctl restart apache2
echo ">>> Installing PHP8"
@ -59,7 +59,7 @@ apt-get install -qq -y lsb-release ca-certificates apt-transport-https software-
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
apt update
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip php8.0-gmp
systemctl restart apache2
#Install mysql

View File

@ -40,7 +40,7 @@ $longopts = ['spawn', 'no_cron'];
$options = getopt($shortopts, $longopts);
// Ensure that worker.php is executed from the base path of the installation
if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
if (!file_exists("index.php") && (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);
if (substr($directory, 0, 1) != '/') {

194
boot.php
View File

@ -1,194 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Friendica is a communications platform for integrated social communications
* utilising decentralised communications and linkage to several indie social
* projects - as well as popular mainstream providers.
*
* Our mission is to free our friends and families from the clutches of
* data-harvesting corporations, and pave the way to a future where social
* communications are free and open and flow between alternate providers as
* easily as email does today.
*/
use Friendica\Model\Contact;
define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'Giant Rhubarb');
define('FRIENDICA_VERSION', '2022.09-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
define('NEW_TABLE_STRUCTURE_VERSION', 1288);
/**
* Constant with a HTML line break.
*
* Contains a HTML line break (br) element and a real carriage return with line
* feed for the source.
* This can be used in HTML and JavaScript where needed a line break.
*/
define('EOL', "<br />\r\n");
/**
* @name CP
*
* Type of the community page
* @{
*/
define('CP_NO_INTERNAL_COMMUNITY', -2);
define('CP_NO_COMMUNITY_PAGE', -1);
define('CP_USERS_ON_SERVER', 0);
define('CP_GLOBAL_COMMUNITY', 1);
define('CP_USERS_AND_GLOBAL', 2);
/**
* @}
*/
/**
* @name Gravity
*
* Item weight for query ordering
* @{
*/
define('GRAVITY_PARENT', 0);
define('GRAVITY_ACTIVITY', 3);
define('GRAVITY_COMMENT', 6);
define('GRAVITY_UNKNOWN', 9);
/* @}*/
/**
* @name Priority
*
* Process priority for the worker
* @{
*/
define('PRIORITY_UNDEFINED', 0);
define('PRIORITY_CRITICAL', 10);
define('PRIORITY_HIGH', 20);
define('PRIORITY_MEDIUM', 30);
define('PRIORITY_LOW', 40);
define('PRIORITY_NEGLIGIBLE', 50);
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
/* @}*/
// Normally this constant is defined - but not if "pcntl" isn't installed
if (!defined('SIGTERM')) {
define('SIGTERM', 15);
}
/**
* Depending on the PHP version this constant does exist - or not.
* See here: http://php.net/manual/en/curl.constants.php#117928
*/
if (!defined('CURLE_OPERATION_TIMEDOUT')) {
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
}
if (!function_exists('exif_imagetype')) {
function exif_imagetype($file)
{
$size = getimagesize($file);
return $size[2];
}
}
/**
* Returns the user id of locally logged in user or false.
*
* @return int|bool user id or false
*/
function local_user()
{
if (!empty($_SESSION['authenticated']) && !empty($_SESSION['uid'])) {
return intval($_SESSION['uid']);
}
return false;
}
/**
* Returns the public contact id of logged in user or false.
*
* @return int|bool public contact id or false
*/
function public_contact()
{
static $public_contact_id = false;
if (!$public_contact_id && !empty($_SESSION['authenticated'])) {
if (!empty($_SESSION['my_address'])) {
// Local user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, false));
} elseif (!empty($_SESSION['visitor_home'])) {
// Remote user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, false));
}
} elseif (empty($_SESSION['authenticated'])) {
$public_contact_id = false;
}
return $public_contact_id;
}
/**
* Returns public contact id of authenticated site visitor or false
*
* @return int|bool visitor_id or false
*/
function remote_user()
{
if (empty($_SESSION['authenticated'])) {
return false;
}
if (!empty($_SESSION['visitor_id'])) {
return intval($_SESSION['visitor_id']);
}
return false;
}
/**
* Show an error message to user.
*
* This function save text in session, to be shown to the user at next page load
*
* @param string $s - Text of notice
*
* @return void
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
*/
function notice(string $s)
{
\Friendica\DI::sysmsg()->addNotice($s);
}
/**
* Show an info message to user.
*
* This function save text in session, to be shown to the user at next page load
*
* @param string $s - Text of notice
*
* @return void
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
*/
function info(string $s)
{
\Friendica\DI::sysmsg()->addInfo($s);
}

View File

@ -41,7 +41,6 @@
"michelf/php-markdown": "^1.7",
"minishlink/web-push": "^6.0",
"mobiledetect/mobiledetectlib": "^2.8",
"monolog/monolog": "^1.25",
"nikic/fast-route": "^1.3",
"paragonie/hidden-string": "^1.0",
"patrickschur/language-detection": "^5.0.0",
@ -50,6 +49,7 @@
"pragmarx/google2fa": "^5.0",
"pragmarx/recovery": "^0.2",
"psr/container": "^1.0",
"psr/log": "^1.1",
"seld/cli-prompt": "^1.0",
"smarty/smarty": "^4",
"ua-parser/uap-php": "^3.9",
@ -59,7 +59,6 @@
"bower-asset/chart-js": "^2.8",
"bower-asset/dompurify": "^1.0",
"bower-asset/fork-awesome": "^1.1",
"bower-asset/vue": "^2.6",
"npm-asset/cropperjs": "1.2.2",
"npm-asset/es-jquery-sortable": "^0.9.13",
"npm-asset/fullcalendar": "^3.10",
@ -83,10 +82,7 @@
"psr-4": {
"Friendica\\": "src/",
"Friendica\\Addon\\": "addon/"
},
"files": [
"boot.php"
]
}
},
"autoload-dev": {
"psr-4": {

755
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2022.09-dev (Giant Rhubarb)
-- DB_UPDATE_VERSION 1479
-- Friendica 2022.12-dev (Giant Rhubarb)
-- DB_UPDATE_VERSION 1486
-- ------------------------------------------
@ -9,8 +9,8 @@
--
CREATE TABLE IF NOT EXISTS `gserver` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`nurl` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`info` text COMMENT '',
@ -22,8 +22,8 @@ CREATE TABLE IF NOT EXISTS `gserver` (
`local-posts` int unsigned COMMENT 'Number of local posts',
`local-comments` int unsigned COMMENT 'Number of local comments',
`directory-type` tinyint DEFAULT 0 COMMENT 'Type of directory service (Poco, Mastodon)',
`poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`poco` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`noscrape` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`network` char(4) NOT NULL DEFAULT '' COMMENT '',
`protocol` tinyint unsigned COMMENT 'The protocol of the server',
`platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
@ -104,7 +104,7 @@ CREATE TABLE IF NOT EXISTS `user` (
--
CREATE TABLE IF NOT EXISTS `item-uri` (
`id` int unsigned NOT NULL auto_increment,
`uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
`uri` varbinary(383) NOT NULL COMMENT 'URI of an item',
`guid` varbinary(255) COMMENT 'A unique identifier for an item',
PRIMARY KEY(`id`),
UNIQUE INDEX `uri` (`uri`),
@ -127,26 +127,28 @@ CREATE TABLE IF NOT EXISTS `contact` (
`keywords` text COMMENT 'public keywords (interests) of the contact',
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
`avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`header` varchar(255) COMMENT 'Header picture',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`avatar` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`header` varbinary(383) COMMENT 'Header picture',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`nurl` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the contact url',
`addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`alias` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`pubkey` text COMMENT 'RSA public key 4096 bit',
`prvkey` text COMMENT 'RSA private key 4096 bit',
`batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`notify` varchar(255) COMMENT '',
`poll` varchar(255) COMMENT '',
`subscribe` varchar(255) COMMENT '',
`batch` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`notify` varbinary(383) COMMENT '',
`poll` varbinary(383) COMMENT '',
`subscribe` varbinary(383) COMMENT '',
`last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
`next-update` datetime COMMENT 'Next connection request',
`success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
`failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
`failed` boolean COMMENT 'Connection failed',
`term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
`last-discovery` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last follower discovery',
`local-data` boolean COMMENT 'Is true when there are posts with this contact on the system',
`blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
`block_reason` text COMMENT 'Node-wide block reason',
`readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
@ -155,7 +157,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`archive` boolean NOT NULL DEFAULT '0' COMMENT '',
`unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
`sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
`baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
`baseurl` varbinary(383) DEFAULT '' COMMENT 'baseurl of the contact',
`gsid` int unsigned COMMENT 'Global Server ID',
`bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
`reason` text COMMENT '',
@ -164,7 +166,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
`protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
`subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
`hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`hub-verify` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`rating` tinyint NOT NULL DEFAULT 0 COMMENT 'Automatically detected feed poll frequency',
`priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Feed poll priority',
`attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
@ -175,15 +177,15 @@ CREATE TABLE IF NOT EXISTS `contact` (
`notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
`fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
`ffi_keyword_denylist` text COMMENT '',
`photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
`thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
`micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
`photo` varbinary(383) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
`thumb` varbinary(383) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
`micro` varbinary(383) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
`name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`request` varchar(255) COMMENT '',
`confirm` varchar(255) COMMENT '',
`poco` varchar(255) COMMENT '',
`request` varbinary(383) COMMENT '',
`confirm` varbinary(383) COMMENT '',
`poco` varbinary(383) COMMENT '',
`writable` boolean NOT NULL DEFAULT '0' COMMENT '',
`forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum. Deprecated, use \'contact-type\' = \'community\' and \'manually-approve\' = false instead',
`prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group. Deprecated, use \'contact-type\' = \'community\' and \'manually-approve\' = true instead',
@ -191,8 +193,8 @@ CREATE TABLE IF NOT EXISTS `contact` (
`site-pubkey` text COMMENT 'Deprecated',
`gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
`duplex` boolean NOT NULL DEFAULT '0' COMMENT 'Deprecated',
`issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'Deprecated',
`dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'Deprecated',
`issued-id` varbinary(383) NOT NULL DEFAULT '' COMMENT 'Deprecated',
`dfrn-id` varbinary(383) NOT NULL DEFAULT '' COMMENT 'Deprecated',
`aes_allow` boolean NOT NULL DEFAULT '0' COMMENT 'Deprecated',
`ret-aes` boolean NOT NULL DEFAULT '0' COMMENT 'Deprecated',
`usehub` boolean NOT NULL DEFAULT '0' COMMENT 'Deprecated',
@ -213,12 +215,14 @@ CREATE TABLE IF NOT EXISTS `contact` (
INDEX `attag_uid` (`attag`(96),`uid`),
INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
INDEX `uid_network_self_lastupdate` (`uid`,`network`,`self`,`last-update`),
INDEX `next-update` (`next-update`),
INDEX `local-data-next-update` (`local-data`,`next-update`),
INDEX `uid_lastitem` (`uid`,`last-item`),
INDEX `baseurl` (`baseurl`(64)),
INDEX `uid_contact-type` (`uid`,`contact-type`),
INDEX `uid_self_contact-type` (`uid`,`self`,`contact-type`),
INDEX `self_network_uid` (`self`,`network`,`uid`),
INDEX `gsid` (`gsid`),
INDEX `gsid_uid_failed` (`gsid`,`uid`,`failed`),
INDEX `uri-id` (`uri-id`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
@ -231,7 +235,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
CREATE TABLE IF NOT EXISTS `tag` (
`id` int unsigned NOT NULL auto_increment COMMENT '',
`name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`type` tinyint unsigned COMMENT 'Type of the tag (Unknown, General Collection, Follower Collection or Account)',
PRIMARY KEY(`id`),
UNIQUE INDEX `type_name_url` (`name`,`url`),
@ -305,6 +309,20 @@ CREATE TABLE IF NOT EXISTS `2fa_trusted_browser` (
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication trusted browsers';
--
-- TABLE account-user
--
CREATE TABLE IF NOT EXISTS `account-user` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the account url',
`uid` mediumint unsigned NOT NULL COMMENT 'User ID',
PRIMARY KEY(`id`),
UNIQUE INDEX `uri-id_uid` (`uri-id`,`uid`),
INDEX `uid_uri-id` (`uid`,`uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Remote and local accounts';
--
-- TABLE addon
--
@ -325,17 +343,17 @@ CREATE TABLE IF NOT EXISTS `addon` (
-- TABLE apcontact
--
CREATE TABLE IF NOT EXISTS `apcontact` (
`url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
`url` varbinary(383) NOT NULL COMMENT 'URL of the contact',
`uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the apcontact url',
`uuid` varchar(255) COMMENT '',
`uuid` varbinary(255) COMMENT '',
`type` varchar(20) NOT NULL COMMENT '',
`following` varchar(255) COMMENT '',
`followers` varchar(255) COMMENT '',
`inbox` varchar(255) NOT NULL COMMENT '',
`outbox` varchar(255) COMMENT '',
`sharedinbox` varchar(255) COMMENT '',
`featured` varchar(255) COMMENT 'Address for the collection of featured posts',
`featured-tags` varchar(255) COMMENT 'Address for the collection of featured tags',
`following` varbinary(383) COMMENT '',
`followers` varbinary(383) COMMENT '',
`inbox` varbinary(383) NOT NULL COMMENT '',
`outbox` varbinary(383) COMMENT '',
`sharedinbox` varbinary(383) COMMENT '',
`featured` varbinary(383) COMMENT 'Address for the collection of featured posts',
`featured-tags` varbinary(383) COMMENT 'Address for the collection of featured tags',
`manually-approve` boolean COMMENT '',
`discoverable` boolean COMMENT 'Mastodon extension: true if profile is published in their directory',
`suspended` boolean COMMENT 'Mastodon extension: true if profile is suspended',
@ -344,13 +362,13 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
`about` text COMMENT '',
`xmpp` varchar(255) COMMENT 'XMPP address',
`matrix` varchar(255) COMMENT 'Matrix address',
`photo` varchar(255) COMMENT '',
`header` varchar(255) COMMENT 'Header picture',
`photo` varbinary(383) COMMENT '',
`header` varbinary(383) COMMENT 'Header picture',
`addr` varchar(255) COMMENT '',
`alias` varchar(255) COMMENT '',
`alias` varbinary(383) COMMENT '',
`pubkey` text COMMENT '',
`subscribe` varchar(255) COMMENT '',
`baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
`subscribe` varbinary(383) COMMENT '',
`baseurl` varbinary(383) COMMENT 'baseurl of the ap contact',
`gsid` int unsigned COMMENT 'Global Server ID',
`generator` varchar(255) COMMENT 'Name of the contact\'s system',
`following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
@ -377,8 +395,8 @@ CREATE TABLE IF NOT EXISTS `application` (
`client_id` varchar(64) NOT NULL COMMENT '',
`client_secret` varchar(64) NOT NULL COMMENT '',
`name` varchar(255) NOT NULL COMMENT '',
`redirect_uri` varchar(255) NOT NULL COMMENT '',
`website` varchar(255) COMMENT '',
`redirect_uri` varbinary(383) NOT NULL COMMENT '',
`website` varbinary(383) COMMENT '',
`scopes` varchar(255) COMMENT '',
`read` boolean COMMENT 'Read scope',
`write` boolean COMMENT 'Write scope',
@ -395,7 +413,7 @@ CREATE TABLE IF NOT EXISTS `application-marker` (
`application-id` int unsigned NOT NULL COMMENT '',
`uid` mediumint unsigned NOT NULL COMMENT 'Owner User id',
`timeline` varchar(64) NOT NULL COMMENT 'Marker (home, notifications)',
`last_read_id` varchar(255) COMMENT 'Marker id for the timeline',
`last_read_id` varbinary(383) COMMENT 'Marker id for the timeline',
`version` smallint unsigned COMMENT 'Version number',
`updated_at` datetime COMMENT 'creation time',
PRIMARY KEY(`application-id`,`uid`,`timeline`),
@ -492,7 +510,7 @@ CREATE TABLE IF NOT EXISTS `contact-relation` (
--
CREATE TABLE IF NOT EXISTS `conv` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
`guid` varbinary(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
`recips` text COMMENT 'sender_handle;recipient_handle',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
`creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
@ -534,7 +552,7 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
--
CREATE TABLE IF NOT EXISTS `delayed-post` (
`id` int unsigned NOT NULL auto_increment,
`uri` varchar(255) COMMENT 'URI of the post that will be distributed later',
`uri` varbinary(383) COMMENT 'URI of the post that will be distributed later',
`uid` mediumint unsigned COMMENT 'Owner User id',
`delayed` datetime COMMENT 'delay time',
`wid` int unsigned COMMENT 'Workerqueue id',
@ -559,7 +577,7 @@ CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
-- TABLE endpoint
--
CREATE TABLE IF NOT EXISTS `endpoint` (
`url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
`url` varbinary(383) NOT NULL COMMENT 'URL of the contact',
`type` varchar(20) NOT NULL COMMENT '',
`owner-uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the apcontact url',
PRIMARY KEY(`url`),
@ -572,10 +590,10 @@ CREATE TABLE IF NOT EXISTS `endpoint` (
--
CREATE TABLE IF NOT EXISTS `event` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`guid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
`cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
`uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`uri` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the event uri',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
@ -605,22 +623,23 @@ CREATE TABLE IF NOT EXISTS `event` (
--
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`guid` varbinary(255) NOT NULL DEFAULT '' COMMENT 'unique id',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the fcontact url',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`request` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`batch` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`notify` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`poll` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`confirm` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
`network` char(4) NOT NULL DEFAULT '' COMMENT '',
`alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`alias` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`pubkey` text COMMENT '',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`interacting_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts this contact interactes with',
`interacted_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts that interacted with this contact',
@ -637,7 +656,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
--
CREATE TABLE IF NOT EXISTS `fetch-entry` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`url` varbinary(255) COMMENT 'url that awaiting to be fetched',
`url` varbinary(383) COMMENT 'url that awaiting to be fetched',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of the fetch request',
`wid` int unsigned COMMENT 'Workerqueue id',
PRIMARY KEY(`id`),
@ -655,9 +674,9 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`request` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`note` text COMMENT '',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
PRIMARY KEY(`id`),
@ -728,10 +747,10 @@ CREATE TABLE IF NOT EXISTS `hook` (
--
CREATE TABLE IF NOT EXISTS `inbox-entry` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`activity-id` varbinary(255) COMMENT 'id of the incoming activity',
`object-id` varbinary(255) COMMENT '',
`in-reply-to-id` varbinary(255) COMMENT '',
`conversation` varbinary(255) COMMENT '',
`activity-id` varbinary(383) COMMENT 'id of the incoming activity',
`object-id` varbinary(383) COMMENT '',
`in-reply-to-id` varbinary(383) COMMENT '',
`conversation` varbinary(383) COMMENT '',
`type` varchar(64) COMMENT 'Type of the activity',
`object-type` varchar(64) COMMENT 'Type of the object activity',
`object-object-type` varchar(64) COMMENT 'Type of the object\'s object activity',
@ -765,7 +784,7 @@ CREATE TABLE IF NOT EXISTS `inbox-entry-receiver` (
-- TABLE inbox-status
--
CREATE TABLE IF NOT EXISTS `inbox-status` (
`url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
`url` varbinary(383) NOT NULL COMMENT 'URL of the inbox',
`uri-id` int unsigned COMMENT 'Item-uri id of inbox url',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
`success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
@ -790,7 +809,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
`knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
`duplex` boolean NOT NULL DEFAULT '0' COMMENT 'deprecated',
`note` text COMMENT '',
`hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`hash` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
`datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`blocked` boolean NOT NULL DEFAULT '0' COMMENT 'deprecated',
`ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
@ -822,11 +841,11 @@ CREATE TABLE IF NOT EXISTS `locks` (
CREATE TABLE IF NOT EXISTS `mail` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
`guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
`guid` varbinary(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
`from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
`from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
`from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
`contact-id` varchar(255) COMMENT 'contact.id',
`from-photo` varbinary(383) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
`from-url` varbinary(383) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
`contact-id` varbinary(255) COMMENT 'contact.id',
`author-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the author of the mail',
`convid` int unsigned COMMENT 'conv.id',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
@ -835,11 +854,11 @@ CREATE TABLE IF NOT EXISTS `mail` (
`reply` boolean NOT NULL DEFAULT '0' COMMENT '',
`replied` boolean NOT NULL DEFAULT '0' COMMENT '',
`unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
`uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`uri` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`uri-id` int unsigned COMMENT 'Item-uri id of the related mail',
`parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`parent-uri` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related mail',
`thr-parent` varchar(255) COMMENT '',
`thr-parent` varbinary(383) COMMENT '',
`thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
PRIMARY KEY(`id`),
@ -916,6 +935,7 @@ CREATE TABLE IF NOT EXISTS `notification` (
INDEX `target-uri-id` (`target-uri-id`),
INDEX `parent-uri-id` (`parent-uri-id`),
INDEX `seen_uid` (`seen`,`uid`),
INDEX `uid_type_parent-uri-id_actor-id` (`uid`,`type`,`parent-uri-id`,`actor-id`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`vid`) REFERENCES `verb` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
FOREIGN KEY (`actor-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
@ -930,12 +950,12 @@ CREATE TABLE IF NOT EXISTS `notify` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`msg` mediumtext COMMENT '',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
`link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`link` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`iid` int unsigned COMMENT '',
`parent` int unsigned COMMENT '',
`uri-id` int unsigned COMMENT 'Item-uri id of the related post',
@ -979,7 +999,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
-- TABLE oembed
--
CREATE TABLE IF NOT EXISTS `oembed` (
`url` varbinary(255) NOT NULL COMMENT 'page url',
`url` varbinary(383) NOT NULL COMMENT 'page url',
`maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
`content` mediumtext COMMENT 'OEmbed data of the page',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
@ -1149,9 +1169,12 @@ CREATE TABLE IF NOT EXISTS `post-category` (
CREATE TABLE IF NOT EXISTS `post-collection` (
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
`type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0 - Featured',
`author-id` int unsigned COMMENT 'Author of the featured post',
PRIMARY KEY(`uri-id`,`type`),
INDEX `type` (`type`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
INDEX `author-id` (`author-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`author-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Collection of posts';
--
@ -1163,6 +1186,7 @@ CREATE TABLE IF NOT EXISTS `post-content` (
`content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`body` mediumtext COMMENT 'item body content',
`raw-body` mediumtext COMMENT 'Body without embedded media links',
`quote-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the quoted uri',
`location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
`coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
`language` text COMMENT 'Language information about this post',
@ -1174,12 +1198,14 @@ CREATE TABLE IF NOT EXISTS `post-content` (
`target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
`target` text COMMENT 'JSON encoded target structure if used',
`resource-id` varchar(32) NOT NULL DEFAULT '' COMMENT 'Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type',
`plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
`plink` varbinary(383) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
PRIMARY KEY(`uri-id`),
INDEX `plink` (`plink`(191)),
INDEX `resource-id` (`resource-id`),
FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
INDEX `quote-uri-id` (`quote-uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`quote-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
--
@ -1241,7 +1267,7 @@ CREATE TABLE IF NOT EXISTS `post-history` (
`target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
`target` text COMMENT 'JSON encoded target structure if used',
`resource-id` varchar(32) NOT NULL DEFAULT '' COMMENT 'Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type',
`plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
`plink` varbinary(383) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
PRIMARY KEY(`uri-id`,`edited`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Post history';
@ -1266,6 +1292,7 @@ CREATE TABLE IF NOT EXISTS `post-media` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
`url` varbinary(1024) NOT NULL COMMENT 'Media URL',
`media-uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the activities uri-id',
`type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Media type',
`mimetype` varchar(60) COMMENT '',
`height` smallint unsigned COMMENT 'Height of the media',
@ -1276,16 +1303,18 @@ CREATE TABLE IF NOT EXISTS `post-media` (
`preview-width` smallint unsigned COMMENT 'Width of the preview picture',
`description` text COMMENT '',
`name` varchar(255) COMMENT 'Name of the media',
`author-url` varbinary(255) COMMENT 'URL of the author of the media',
`author-url` varbinary(383) COMMENT 'URL of the author of the media',
`author-name` varchar(255) COMMENT 'Name of the author of the media',
`author-image` varbinary(255) COMMENT 'Image of the author of the media',
`publisher-url` varbinary(255) COMMENT 'URL of the publisher of the media',
`author-image` varbinary(383) COMMENT 'Image of the author of the media',
`publisher-url` varbinary(383) COMMENT 'URL of the publisher of the media',
`publisher-name` varchar(255) COMMENT 'Name of the publisher of the media',
`publisher-image` varbinary(255) COMMENT 'Image of the publisher of the media',
`publisher-image` varbinary(383) COMMENT 'Image of the publisher of the media',
PRIMARY KEY(`id`),
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`(512)),
INDEX `uri-id-id` (`uri-id`,`id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
INDEX `media-uri-id` (`media-uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`media-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Attached media';
--
@ -1408,6 +1437,7 @@ CREATE TABLE IF NOT EXISTS `post-user` (
INDEX `author-id_uid` (`author-id`,`uid`),
INDEX `author-id_received` (`author-id`,`received`),
INDEX `parent-uri-id_uid` (`parent-uri-id`,`uid`),
INDEX `uid_wall_received` (`uid`,`wall`,`received`),
INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
INDEX `uid_unseen` (`uid`,`unseen`),
@ -1549,8 +1579,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
`homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
`photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`thumb` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
`net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
PRIMARY KEY(`id`),
@ -1585,7 +1615,7 @@ CREATE TABLE IF NOT EXISTS `profile_field` (
CREATE TABLE IF NOT EXISTS `push_subscriber` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`callback_url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
@ -1604,7 +1634,7 @@ CREATE TABLE IF NOT EXISTS `push_subscriber` (
--
CREATE TABLE IF NOT EXISTS `register` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`hash` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
@ -1704,7 +1734,7 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
`fetch_further_information` tinyint unsigned COMMENT '',
`ffi_keyword_denylist` text COMMENT '',
`subhub` boolean COMMENT '',
`hub-verify` varchar(255) COMMENT '',
`hub-verify` varbinary(383) COMMENT '',
`protocol` char(4) COMMENT 'Protocol of the contact',
`rating` tinyint COMMENT 'Automatically detected feed poll frequency',
`priority` tinyint unsigned COMMENT 'Feed poll priority',
@ -1720,7 +1750,7 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
-- TABLE arrived-activity
--
CREATE TABLE IF NOT EXISTS `arrived-activity` (
`object-id` varbinary(255) NOT NULL COMMENT 'object id of the incoming activity',
`object-id` varbinary(383) NOT NULL COMMENT 'object id of the incoming activity',
`received` datetime COMMENT 'Receiving date',
PRIMARY KEY(`object-id`)
) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Id of arrived activities';
@ -1729,7 +1759,7 @@ CREATE TABLE IF NOT EXISTS `arrived-activity` (
-- TABLE fetched-activity
--
CREATE TABLE IF NOT EXISTS `fetched-activity` (
`object-id` varbinary(255) NOT NULL COMMENT 'object id of fetched activity',
`object-id` varbinary(383) NOT NULL COMMENT 'object id of fetched activity',
`received` datetime COMMENT 'Receiving date',
PRIMARY KEY(`object-id`)
) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Id of fetched activities';
@ -1783,6 +1813,8 @@ CREATE VIEW `post-user-view` AS SELECT
`post-user`.`thr-parent-id` AS `thr-parent-id`,
`conversation-item-uri`.`uri` AS `conversation`,
`post-thread-user`.`conversation-id` AS `conversation-id`,
`quote-item-uri`.`uri` AS `quote-uri`,
`post-content`.`quote-uri-id` AS `quote-uri-id`,
`item-uri`.`guid` AS `guid`,
`post-user`.`wall` AS `wall`,
`post-user`.`gravity` AS `gravity`,
@ -1938,6 +1970,7 @@ CREATE VIEW `post-user-view` AS SELECT
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
@ -1961,6 +1994,8 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`post-user`.`thr-parent-id` AS `thr-parent-id`,
`conversation-item-uri`.`uri` AS `conversation`,
`post-thread-user`.`conversation-id` AS `conversation-id`,
`quote-item-uri`.`uri` AS `quote-uri`,
`post-content`.`quote-uri-id` AS `quote-uri-id`,
`item-uri`.`guid` AS `guid`,
`post-thread-user`.`wall` AS `wall`,
`post-user`.`gravity` AS `gravity`,
@ -2114,6 +2149,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
@ -2133,6 +2169,8 @@ CREATE VIEW `post-view` AS SELECT
`post`.`thr-parent-id` AS `thr-parent-id`,
`conversation-item-uri`.`uri` AS `conversation`,
`post-thread`.`conversation-id` AS `conversation-id`,
`quote-item-uri`.`uri` AS `quote-uri`,
`post-content`.`quote-uri-id` AS `quote-uri-id`,
`item-uri`.`guid` AS `guid`,
`post`.`gravity` AS `gravity`,
`external-item-uri`.`uri` AS `extid`,
@ -2255,6 +2293,7 @@ CREATE VIEW `post-view` AS SELECT
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
@ -2272,6 +2311,8 @@ CREATE VIEW `post-thread-view` AS SELECT
`post`.`thr-parent-id` AS `thr-parent-id`,
`conversation-item-uri`.`uri` AS `conversation`,
`post-thread`.`conversation-id` AS `conversation-id`,
`quote-item-uri`.`uri` AS `quote-uri`,
`post-content`.`quote-uri-id` AS `quote-uri-id`,
`item-uri`.`guid` AS `guid`,
`post`.`gravity` AS `gravity`,
`external-item-uri`.`uri` AS `extid`,
@ -2394,6 +2435,7 @@ CREATE VIEW `post-thread-view` AS SELECT
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
@ -2419,7 +2461,7 @@ DROP VIEW IF EXISTS `collection-view`;
CREATE VIEW `collection-view` AS SELECT
`post-collection`.`uri-id` AS `uri-id`,
`post-collection`.`type` AS `type`,
`post`.`author-id` AS `cid`,
`post-collection`.`author-id` AS `cid`,
`post`.`received` AS `received`,
`post`.`created` AS `created`,
`post-thread`.`commented` AS `commented`,
@ -2427,7 +2469,7 @@ CREATE VIEW `collection-view` AS SELECT
`post`.`visible` AS `visible`,
`post`.`deleted` AS `deleted`,
`post`.`thr-parent-id` AS `thr-parent-id`,
`post`.`author-id` AS `author-id`,
`post-collection`.`author-id` AS `author-id`,
`post`.`gravity` AS `gravity`
FROM `post-collection`
INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`

View File

@ -410,13 +410,13 @@ Ex: Wed May 23 06:01:13 +0000 2007
</tr>
<tr>
<td><code>startTime</code></td>
<td><code>start_time</code></td>
<td>String (UTC <code>YYYY-MM-DD HH:II:SS)</code>)</td>
<td></td>
</tr>
<tr>
<td><code>endTime</code></td>
<td><code>end_time</code></td>
<td>String (UTC <code>YYYY-MM-DD HH:II:SS)</code>)</td>
<td>Optional (null date is <code>0001-01-01 00:00:00</code></td>
</tr>

View File

@ -24,6 +24,32 @@ Returns a list of [Event](help/API-Entities#Event) entities for the current logg
- `since_id`: (optional) minimum event id for pagination
- `count`: maximum number of items returned, default 20
### POST api/friendica/event_create
Create a new event for the current logged in user.
#### Parameters
- `id` : (optional) id of event, event will be amended if supplied
- `name` : name of the event (required)
- `start_time` : start of the event (ISO), required
- `end_time` : (optional) end of the event, event is open end, if not supplied
- `desc` : (optional) description of the event
- `place` : (optional) location of the event
- `publish` : (optional) create message for event
- `allow_cid` : (optional) ACL-formatted list of allowed contact ids if private event
- `allow_gid` : (optional) ACL-formatted list of disallowed contact ids if private event
- `deny_cid` : (optional) ACL-formatted list of allowed group ids if private event
- `deny_gid` : (optional) ACL-formatted list of disallowed group ids if private event
### POST api/friendica/event_delete
Delete event from calendar (not the message)
#### Parameters
- `id` : id of event to be deleted
### GET api/externalprofile/show
Returns a [Contact](help/API-Entities#Contact) entity for the provided profile URL.

View File

@ -281,7 +281,7 @@ $data = [
'submit' => [
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
'catavatar-morecat' => DI::l10n()->t('Another random Cat!'),
'catavatar-emailcat' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
'catavatar-emailcat' => DI::pConfig()->get(Session::getLocalUser(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
],
];
```
@ -919,6 +919,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('block', $hook_data);
Hook::callAll('unblock', $hook_data);
### src/Core/Logger/Factory.php
Hook::callAll('logger_instance', $data);
### src/Core/StorageManager
Hook::callAll('storage_instance', $data);

View File

@ -6,7 +6,7 @@ Using Composer
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
* [Class autoloading](help/autoloader)

View File

@ -30,7 +30,7 @@ function doSomething(array $intros)
}
}
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => local_user()]);
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => Session::getLocalUser()]);
doSomething($intros);
```
@ -47,7 +47,7 @@ function doSomething(\Friendica\Contact\Introductions\Collection\Introductions $
}
/** @var $intros \Friendica\Contact\Introductions\Collection\Introductions */
$intros = \Friendica\DI::intro()->selecForUser(local_user());
$intros = \Friendica\DI::intro()->selecForUser(Session::getLocalUser());
doSomething($intros);
```

View File

@ -47,7 +47,7 @@ Friendica uses an implementation of [Domain-Driven-Design](help/Developer-Domain
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
If you want to have git automatically update the dependencies with composer, you can use the `post-merge` [git-hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) with a script similar to this one:

View File

@ -34,7 +34,7 @@ Due to the large variety of operating systems and PHP platforms in existence we
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
* Some form of email server or email gateway such that PHP mail() works.
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
* MySQL 5.6+ or an equivalent alternative for MySQL (MariaDB, Percona Server etc.)
* MySQL with support of InnoDB and Barracuda (we suggest a MariaDB server as all development is done using these, but alternatives like MySQL or Percona Server etc. might work as well)
* ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows)
* installation into a top-level domain or sub-domain (without a directory/path component in the URL) is RECOMMENDED. Directory paths will not be as convenient to use and have not been thoroughly tested. This is REQUIRED if you wish to communicate with the Diaspora network.

View File

@ -10,7 +10,7 @@ Getting started
No need to setup up a webserver, database etc. before actually starting.
Vagrant creates a virtual machine for you that you can just run inside VirtualBox and start to work directly on Friendica.
It brings an Debian Bullseye with PHP 7.4 and MariaDB 10.5.11.
It brings an Debian Bullseye with PHP 8.0 and MariaDB 10.5.11.
What you need to do:
@ -24,7 +24,7 @@ This will start the virtual machine.
Be patient: When it runs for the first time, it downloads a Debian Server image and installs Friendica.
4. Run `vagrant ssh` to log into the virtual machine to log in to the VM in case you need to debug something on the server.
5. Open you test installation in a browser.
Go to friendica.local (or 192.168.22.10).
Go to friendica.local (or 192.168.56.10).
friendica.local is using a self-signed TLS certificate, so you will need to add an exception to trust the certificate the first time you are visiting the page.
The mysql database is called "friendica", the mysql user and password both are "friendica".
6. Work on Friendica's code in your git clone on your machine (not in the VM).
@ -66,4 +66,4 @@ On the next Vagrant up, the version problem should be fixed.
If `friendica.local` is not resolved, you may need to add an entry to the `/etc/hosts` file (or similar configuration depending on the OS you are using).
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).

View File

@ -6,7 +6,7 @@ Autoloader with Composer
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
* [Using Composer](help/Composer)
@ -39,7 +39,6 @@ Namespaces are useful to keep classes separated and avoid names conflicts (could
Let's say now that you need to load some items in a view, maybe in a fictional `mod/network.php`.
In order for the Composer autoloader to work, it must first be included.
In Friendica this is already done at the top of `boot.php`, with `require_once('vendor/autoload.php');`.
The code will be something like:

View File

@ -8,6 +8,7 @@ Database Tables
| [2fa_app_specific_password](help/database/db_2fa_app_specific_password) | Two-factor app-specific _password |
| [2fa_recovery_codes](help/database/db_2fa_recovery_codes) | Two-factor authentication recovery codes |
| [2fa_trusted_browser](help/database/db_2fa_trusted_browser) | Two-factor authentication trusted browsers |
| [account-user](help/database/db_account-user) | Remote and local accounts |
| [addon](help/database/db_addon) | registered addons |
| [apcontact](help/database/db_apcontact) | ActivityPub compatible contacts - used in the ActivityPub implementation |
| [application](help/database/db_application) | OAuth application |

View File

@ -0,0 +1,32 @@
Table account-user
===========
Remote and local accounts
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| ------ | ------------------------------------------------------------ | ------------------ | ---- | --- | ------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uri-id | Id of the item-uri table entry that contains the account url | int unsigned | NO | | NULL | |
| uid | User ID | mediumint unsigned | NO | | NULL | |
Indexes
------------
| Name | Fields |
| ---------- | ------------------- |
| PRIMARY | id |
| uri-id_uid | UNIQUE, uri-id, uid |
| uid_uri-id | uid, uri-id |
Foreign Keys
------------
| Field | Target Table | Target Field |
|-------|--------------|--------------|
| uri-id | [item-uri](help/database/db_item-uri) | id |
| uid | [user](help/database/db_user) | uid |
Return to [database documentation](help/database)

View File

@ -8,17 +8,17 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ---------------- | ------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
| url | URL of the contact | varbinary(255) | NO | PRI | NULL | |
| url | URL of the contact | varbinary(383) | NO | PRI | NULL | |
| uri-id | Id of the item-uri table entry that contains the apcontact url | int unsigned | YES | | NULL | |
| uuid | | varchar(255) | YES | | NULL | |
| uuid | | varbinary(255) | YES | | NULL | |
| type | | varchar(20) | NO | | NULL | |
| following | | varchar(255) | YES | | NULL | |
| followers | | varchar(255) | YES | | NULL | |
| inbox | | varchar(255) | NO | | NULL | |
| outbox | | varchar(255) | YES | | NULL | |
| sharedinbox | | varchar(255) | YES | | NULL | |
| featured | Address for the collection of featured posts | varchar(255) | YES | | NULL | |
| featured-tags | Address for the collection of featured tags | varchar(255) | YES | | NULL | |
| following | | varbinary(383) | YES | | NULL | |
| followers | | varbinary(383) | YES | | NULL | |
| inbox | | varbinary(383) | NO | | NULL | |
| outbox | | varbinary(383) | YES | | NULL | |
| sharedinbox | | varbinary(383) | YES | | NULL | |
| featured | Address for the collection of featured posts | varbinary(383) | YES | | NULL | |
| featured-tags | Address for the collection of featured tags | varbinary(383) | YES | | NULL | |
| manually-approve | | boolean | YES | | NULL | |
| discoverable | Mastodon extension: true if profile is published in their directory | boolean | YES | | NULL | |
| suspended | Mastodon extension: true if profile is suspended | boolean | YES | | NULL | |
@ -27,13 +27,13 @@ Fields
| about | | text | YES | | NULL | |
| xmpp | XMPP address | varchar(255) | YES | | NULL | |
| matrix | Matrix address | varchar(255) | YES | | NULL | |
| photo | | varchar(255) | YES | | NULL | |
| header | Header picture | varchar(255) | YES | | NULL | |
| photo | | varbinary(383) | YES | | NULL | |
| header | Header picture | varbinary(383) | YES | | NULL | |
| addr | | varchar(255) | YES | | NULL | |
| alias | | varchar(255) | YES | | NULL | |
| alias | | varbinary(383) | YES | | NULL | |
| pubkey | | text | YES | | NULL | |
| subscribe | | varchar(255) | YES | | NULL | |
| baseurl | baseurl of the ap contact | varchar(255) | YES | | NULL | |
| subscribe | | varbinary(383) | YES | | NULL | |
| baseurl | baseurl of the ap contact | varbinary(383) | YES | | NULL | |
| gsid | Global Server ID | int unsigned | YES | | NULL | |
| generator | Name of the contact's system | varchar(255) | YES | | NULL | |
| following_count | Number of following contacts | int unsigned | YES | | 0 | |

View File

@ -11,7 +11,7 @@ Fields
| application-id | | int unsigned | NO | PRI | NULL | |
| uid | Owner User id | mediumint unsigned | NO | PRI | NULL | |
| timeline | Marker (home, notifications) | varchar(64) | NO | PRI | NULL | |
| last_read_id | Marker id for the timeline | varchar(255) | YES | | NULL | |
| last_read_id | Marker id for the timeline | varbinary(383) | YES | | NULL | |
| version | Version number | smallint unsigned | YES | | NULL | |
| updated_at | creation time | datetime | YES | | NULL | |

View File

@ -6,19 +6,19 @@ OAuth application
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| ------------- | --------------- | ------------ | ---- | --- | ------- | -------------- |
| id | generated index | int unsigned | NO | PRI | NULL | auto_increment |
| client_id | | varchar(64) | NO | | NULL | |
| client_secret | | varchar(64) | NO | | NULL | |
| name | | varchar(255) | NO | | NULL | |
| redirect_uri | | varchar(255) | NO | | NULL | |
| website | | varchar(255) | YES | | NULL | |
| scopes | | varchar(255) | YES | | NULL | |
| read | Read scope | boolean | YES | | NULL | |
| write | Write scope | boolean | YES | | NULL | |
| follow | Follow scope | boolean | YES | | NULL | |
| push | Push scope | boolean | YES | | NULL | |
| Field | Description | Type | Null | Key | Default | Extra |
| ------------- | --------------- | -------------- | ---- | --- | ------- | -------------- |
| id | generated index | int unsigned | NO | PRI | NULL | auto_increment |
| client_id | | varchar(64) | NO | | NULL | |
| client_secret | | varchar(64) | NO | | NULL | |
| name | | varchar(255) | NO | | NULL | |
| redirect_uri | | varbinary(383) | NO | | NULL | |
| website | | varbinary(383) | YES | | NULL | |
| scopes | | varchar(255) | YES | | NULL | |
| read | Read scope | boolean | YES | | NULL | |
| write | Write scope | boolean | YES | | NULL | |
| follow | Follow scope | boolean | YES | | NULL | |
| push | Push scope | boolean | YES | | NULL | |
Indexes
------------

View File

@ -8,7 +8,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| --------- | ---------------------------------- | -------------- | ---- | --- | ------- | ----- |
| object-id | object id of the incoming activity | varbinary(255) | NO | PRI | NULL | |
| object-id | object id of the incoming activity | varbinary(383) | NO | PRI | NULL | |
| received | Receiving date | datetime | YES | | NULL | |
Indexes

View File

@ -20,26 +20,28 @@ Fields
| keywords | public keywords (interests) of the contact | text | YES | | NULL | |
| xmpp | XMPP address | varchar(255) | NO | | | |
| matrix | Matrix address | varchar(255) | NO | | | |
| avatar | | varchar(255) | NO | | | |
| header | Header picture | varchar(255) | YES | | NULL | |
| url | | varchar(255) | NO | | | |
| nurl | | varchar(255) | NO | | | |
| avatar | | varbinary(383) | NO | | | |
| header | Header picture | varbinary(383) | YES | | NULL | |
| url | | varbinary(383) | NO | | | |
| nurl | | varbinary(383) | NO | | | |
| uri-id | Id of the item-uri table entry that contains the contact url | int unsigned | YES | | NULL | |
| addr | | varchar(255) | NO | | | |
| alias | | varchar(255) | NO | | | |
| alias | | varbinary(383) | NO | | | |
| pubkey | RSA public key 4096 bit | text | YES | | NULL | |
| prvkey | RSA private key 4096 bit | text | YES | | NULL | |
| batch | | varchar(255) | NO | | | |
| notify | | varchar(255) | YES | | NULL | |
| poll | | varchar(255) | YES | | NULL | |
| subscribe | | varchar(255) | YES | | NULL | |
| batch | | varbinary(383) | NO | | | |
| notify | | varbinary(383) | YES | | NULL | |
| poll | | varbinary(383) | YES | | NULL | |
| subscribe | | varbinary(383) | YES | | NULL | |
| last-update | Date of the last try to update the contact info | datetime | NO | | 0001-01-01 00:00:00 | |
| next-update | Next connection request | datetime | YES | | NULL | |
| success_update | Date of the last successful contact update | datetime | NO | | 0001-01-01 00:00:00 | |
| failure_update | Date of the last failed update | datetime | NO | | 0001-01-01 00:00:00 | |
| failed | Connection failed | boolean | YES | | NULL | |
| term-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| last-item | date of the last post | datetime | NO | | 0001-01-01 00:00:00 | |
| last-discovery | date of the last follower discovery | datetime | NO | | 0001-01-01 00:00:00 | |
| local-data | Is true when there are posts with this contact on the system | boolean | YES | | NULL | |
| blocked | Node-wide block status | boolean | NO | | 1 | |
| block_reason | Node-wide block reason | text | YES | | NULL | |
| readonly | posts of the contact are readonly | boolean | NO | | 0 | |
@ -48,7 +50,7 @@ Fields
| archive | | boolean | NO | | 0 | |
| unsearchable | Contact prefers to not be searchable | boolean | NO | | 0 | |
| sensitive | Contact posts sensitive content | boolean | NO | | 0 | |
| baseurl | baseurl of the contact | varchar(255) | YES | | | |
| baseurl | baseurl of the contact | varbinary(383) | YES | | | |
| gsid | Global Server ID | int unsigned | YES | | NULL | |
| bd | | date | NO | | 0001-01-01 | |
| reason | | text | YES | | NULL | |
@ -57,7 +59,7 @@ Fields
| rel | The kind of the relation between the user and the contact | tinyint unsigned | NO | | 0 | |
| protocol | Protocol of the contact | char(4) | NO | | | |
| subhub | | boolean | NO | | 0 | |
| hub-verify | | varchar(255) | NO | | | |
| hub-verify | | varbinary(383) | NO | | | |
| rating | Automatically detected feed poll frequency | tinyint | NO | | 0 | |
| priority | Feed poll priority | tinyint unsigned | NO | | 0 | |
| attag | | varchar(255) | NO | | | |
@ -68,15 +70,15 @@ Fields
| notify_new_posts | | boolean | NO | | 0 | |
| fetch_further_information | | tinyint unsigned | NO | | 0 | |
| ffi_keyword_denylist | | text | YES | | NULL | |
| photo | Link to the profile photo of the contact | varchar(255) | YES | | | |
| thumb | Link to the profile photo (thumb size) | varchar(255) | YES | | | |
| micro | Link to the profile photo (micro size) | varchar(255) | YES | | | |
| photo | Link to the profile photo of the contact | varbinary(383) | YES | | | |
| thumb | Link to the profile photo (thumb size) | varbinary(383) | YES | | | |
| micro | Link to the profile photo (micro size) | varbinary(383) | YES | | | |
| name-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| uri-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| avatar-date | | datetime | NO | | 0001-01-01 00:00:00 | |
| request | | varchar(255) | YES | | NULL | |
| confirm | | varchar(255) | YES | | NULL | |
| poco | | varchar(255) | YES | | NULL | |
| request | | varbinary(383) | YES | | NULL | |
| confirm | | varbinary(383) | YES | | NULL | |
| poco | | varbinary(383) | YES | | NULL | |
| writable | | boolean | NO | | 0 | |
| forum | contact is a forum. Deprecated, use 'contact-type' = 'community' and 'manually-approve' = false instead | boolean | NO | | 0 | |
| prv | contact is a private group. Deprecated, use 'contact-type' = 'community' and 'manually-approve' = true instead | boolean | NO | | 0 | |
@ -84,8 +86,8 @@ Fields
| site-pubkey | Deprecated | text | YES | | NULL | |
| gender | Deprecated | varchar(32) | NO | | | |
| duplex | Deprecated | boolean | NO | | 0 | |
| issued-id | Deprecated | varchar(255) | NO | | | |
| dfrn-id | Deprecated | varchar(255) | NO | | | |
| issued-id | Deprecated | varbinary(383) | NO | | | |
| dfrn-id | Deprecated | varbinary(383) | NO | | | |
| aes_allow | Deprecated | boolean | NO | | 0 | |
| ret-aes | Deprecated | boolean | NO | | 0 | |
| usehub | Deprecated | boolean | NO | | 0 | |
@ -112,12 +114,14 @@ Indexes
| attag_uid | attag(96), uid |
| network_uid_lastupdate | network, uid, last-update |
| uid_network_self_lastupdate | uid, network, self, last-update |
| next-update | next-update |
| local-data-next-update | local-data, next-update |
| uid_lastitem | uid, last-item |
| baseurl | baseurl(64) |
| uid_contact-type | uid, contact-type |
| uid_self_contact-type | uid, self, contact-type |
| self_network_uid | self, network, uid |
| gsid | gsid |
| gsid_uid_failed | gsid, uid, failed |
| uri-id | uri-id |
Foreign Keys

View File

@ -9,7 +9,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ------- | ----------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| guid | A unique identifier for this conversation | varchar(255) | NO | | | |
| guid | A unique identifier for this conversation | varbinary(255) | NO | | | |
| recips | sender_handle;recipient_handle | text | YES | | NULL | |
| uid | Owner User id | mediumint unsigned | NO | | 0 | |
| creator | handle of creator | varchar(255) | NO | | | |

View File

@ -9,7 +9,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ------- | ---------------------------------------------- | ------------------ | ---- | --- | ------- | -------------- |
| id | | int unsigned | NO | PRI | NULL | auto_increment |
| uri | URI of the post that will be distributed later | varchar(255) | YES | | NULL | |
| uri | URI of the post that will be distributed later | varbinary(383) | YES | | NULL | |
| uid | Owner User id | mediumint unsigned | YES | | NULL | |
| delayed | delay time | datetime | YES | | NULL | |
| wid | Workerqueue id | int unsigned | YES | | NULL | |

View File

@ -8,7 +8,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ------------ | -------------------------------------------------------------- | -------------- | ---- | --- | ------- | ----- |
| url | URL of the contact | varbinary(255) | NO | PRI | NULL | |
| url | URL of the contact | varbinary(383) | NO | PRI | NULL | |
| type | | varchar(20) | NO | | NULL | |
| owner-uri-id | Id of the item-uri table entry that contains the apcontact url | int unsigned | YES | | NULL | |

View File

@ -9,10 +9,10 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| --------- | ---------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| guid | | varchar(255) | NO | | | |
| guid | | varbinary(255) | NO | | | |
| uid | Owner User id | mediumint unsigned | NO | | 0 | |
| cid | contact_id (ID of the contact in contact table) | int unsigned | NO | | 0 | |
| uri | | varchar(255) | NO | | | |
| uri | | varbinary(383) | NO | | | |
| uri-id | Id of the item-uri table entry that contains the event uri | int unsigned | YES | | NULL | |
| created | creation time | datetime | NO | | 0001-01-01 00:00:00 | |
| edited | last edit time | datetime | NO | | 0001-01-01 00:00:00 | |

View File

@ -9,22 +9,23 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ----------------- | ------------------------------------------------------------- | ---------------- | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| guid | unique id | varchar(255) | NO | | | |
| url | | varchar(255) | NO | | | |
| guid | unique id | varbinary(255) | NO | | | |
| url | | varbinary(383) | NO | | | |
| uri-id | Id of the item-uri table entry that contains the fcontact url | int unsigned | YES | | NULL | |
| name | | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| request | | varchar(255) | NO | | | |
| photo | | varbinary(383) | NO | | | |
| request | | varbinary(383) | NO | | | |
| nick | | varchar(255) | NO | | | |
| addr | | varchar(255) | NO | | | |
| batch | | varchar(255) | NO | | | |
| notify | | varchar(255) | NO | | | |
| poll | | varchar(255) | NO | | | |
| confirm | | varchar(255) | NO | | | |
| batch | | varbinary(383) | NO | | | |
| notify | | varbinary(383) | NO | | | |
| poll | | varbinary(383) | NO | | | |
| confirm | | varbinary(383) | NO | | | |
| priority | | tinyint unsigned | NO | | 0 | |
| network | | char(4) | NO | | | |
| alias | | varchar(255) | NO | | | |
| alias | | varbinary(383) | NO | | | |
| pubkey | | text | YES | | NULL | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
| interacting_count | Number of contacts this contact interactes with | int unsigned | YES | | 0 | |
| interacted_count | Number of contacts that interacted with this contact | int unsigned | YES | | 0 | |

View File

@ -9,7 +9,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ------- | ---------------------------------- | -------------- | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| url | url that awaiting to be fetched | varbinary(255) | YES | | NULL | |
| url | url that awaiting to be fetched | varbinary(383) | YES | | NULL | |
| created | Creation date of the fetch request | datetime | NO | | 0001-01-01 00:00:00 | |
| wid | Workerqueue id | int unsigned | YES | | NULL | |

View File

@ -8,7 +8,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| --------- | ----------------------------- | -------------- | ---- | --- | ------- | ----- |
| object-id | object id of fetched activity | varbinary(255) | NO | PRI | NULL | |
| object-id | object id of fetched activity | varbinary(383) | NO | PRI | NULL | |
| received | Receiving date | datetime | YES | | NULL | |
Indexes

View File

@ -12,9 +12,9 @@ Fields
| uid | User id | mediumint unsigned | NO | | 0 | |
| cid | | int unsigned | NO | | 0 | |
| name | | varchar(255) | NO | | | |
| url | | varchar(255) | NO | | | |
| request | | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| url | | varbinary(383) | NO | | | |
| request | | varbinary(383) | NO | | | |
| photo | | varbinary(383) | NO | | | |
| note | | text | YES | | NULL | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |

View File

@ -9,8 +9,8 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| --------------------- | -------------------------------------------------- | ---------------- | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| url | | varchar(255) | NO | | | |
| nurl | | varchar(255) | NO | | | |
| url | | varbinary(383) | NO | | | |
| nurl | | varbinary(383) | NO | | | |
| version | | varchar(255) | NO | | | |
| site_name | | varchar(255) | NO | | | |
| info | | text | YES | | NULL | |
@ -22,8 +22,8 @@ Fields
| local-posts | Number of local posts | int unsigned | YES | | NULL | |
| local-comments | Number of local comments | int unsigned | YES | | NULL | |
| directory-type | Type of directory service (Poco, Mastodon) | tinyint | YES | | 0 | |
| poco | | varchar(255) | NO | | | |
| noscrape | | varchar(255) | NO | | | |
| poco | | varbinary(383) | NO | | | |
| noscrape | | varbinary(383) | NO | | | |
| network | | char(4) | NO | | | |
| protocol | The protocol of the server | tinyint unsigned | YES | | NULL | |
| platform | | varchar(255) | NO | | | |

View File

@ -9,10 +9,10 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ------------------ | -------------------------------------- | -------------- | ---- | --- | ------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| activity-id | id of the incoming activity | varbinary(255) | YES | | NULL | |
| object-id | | varbinary(255) | YES | | NULL | |
| in-reply-to-id | | varbinary(255) | YES | | NULL | |
| conversation | | varbinary(255) | YES | | NULL | |
| activity-id | id of the incoming activity | varbinary(383) | YES | | NULL | |
| object-id | | varbinary(383) | YES | | NULL | |
| in-reply-to-id | | varbinary(383) | YES | | NULL | |
| conversation | | varbinary(383) | YES | | NULL | |
| type | Type of the activity | varchar(64) | YES | | NULL | |
| object-type | Type of the object activity | varchar(64) | YES | | NULL | |
| object-object-type | Type of the object's object activity | varchar(64) | YES | | NULL | |

View File

@ -8,7 +8,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| -------- | ------------------------------------ | -------------- | ---- | --- | ------------------- | ----- |
| url | URL of the inbox | varbinary(255) | NO | PRI | NULL | |
| url | URL of the inbox | varbinary(383) | NO | PRI | NULL | |
| uri-id | Item-uri id of inbox url | int unsigned | YES | | NULL | |
| created | Creation date of this entry | datetime | NO | | 0001-01-01 00:00:00 | |
| success | Date of the last successful delivery | datetime | NO | | 0001-01-01 00:00:00 | |

View File

@ -16,7 +16,7 @@ Fields
| knowyou | | boolean | NO | | 0 | |
| duplex | deprecated | boolean | NO | | 0 | |
| note | | text | YES | | NULL | |
| hash | | varchar(255) | NO | | | |
| hash | | varbinary(255) | NO | | | |
| datetime | | datetime | NO | | 0001-01-01 00:00:00 | |
| blocked | deprecated | boolean | NO | | 0 | |
| ignore | | boolean | NO | | 0 | |

View File

@ -9,7 +9,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| ----- | ------------------------------- | -------------- | ---- | --- | ------- | -------------- |
| id | | int unsigned | NO | PRI | NULL | auto_increment |
| uri | URI of an item | varbinary(255) | NO | | NULL | |
| uri | URI of an item | varbinary(383) | NO | | NULL | |
| guid | A unique identifier for an item | varbinary(255) | YES | | NULL | |
Indexes

View File

@ -10,11 +10,11 @@ Fields
| ------------- | -------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uid | Owner User id | mediumint unsigned | NO | | 0 | |
| guid | A unique identifier for this private message | varchar(255) | NO | | | |
| guid | A unique identifier for this private message | varbinary(255) | NO | | | |
| from-name | name of the sender | varchar(255) | NO | | | |
| from-photo | contact photo link of the sender | varchar(255) | NO | | | |
| from-url | profile linke of the sender | varchar(255) | NO | | | |
| contact-id | contact.id | varchar(255) | YES | | NULL | |
| from-photo | contact photo link of the sender | varbinary(383) | NO | | | |
| from-url | profile linke of the sender | varbinary(383) | NO | | | |
| contact-id | contact.id | varbinary(255) | YES | | NULL | |
| author-id | Link to the contact table with uid=0 of the author of the mail | int unsigned | YES | | NULL | |
| convid | conv.id | int unsigned | YES | | NULL | |
| title | | varchar(255) | NO | | | |
@ -23,11 +23,11 @@ Fields
| reply | | boolean | NO | | 0 | |
| replied | | boolean | NO | | 0 | |
| unknown | if sender not in the contact table this is 1 | boolean | NO | | 0 | |
| uri | | varchar(255) | NO | | | |
| uri | | varbinary(383) | NO | | | |
| uri-id | Item-uri id of the related mail | int unsigned | YES | | NULL | |
| parent-uri | | varchar(255) | NO | | | |
| parent-uri | | varbinary(383) | NO | | | |
| parent-uri-id | Item-uri id of the parent of the related mail | int unsigned | YES | | NULL | |
| thr-parent | | varchar(255) | YES | | NULL | |
| thr-parent | | varbinary(383) | YES | | NULL | |
| thr-parent-id | Id of the item-uri table that contains the thread parent uri | int unsigned | YES | | NULL | |
| created | creation time of the private message | datetime | NO | | 0001-01-01 00:00:00 | |

View File

@ -31,6 +31,7 @@ Indexes
| target-uri-id | target-uri-id |
| parent-uri-id | parent-uri-id |
| seen_uid | seen, uid |
| uid_type_parent-uri-id_actor-id | uid, type, parent-uri-id, actor-id |
Foreign Keys
------------

View File

@ -11,12 +11,12 @@ Fields
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| type | | smallint unsigned | NO | | 0 | |
| name | | varchar(255) | NO | | | |
| url | | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| url | | varbinary(383) | NO | | | |
| photo | | varbinary(383) | NO | | | |
| date | | datetime | NO | | 0001-01-01 00:00:00 | |
| msg | | mediumtext | YES | | NULL | |
| uid | Owner User id | mediumint unsigned | NO | | 0 | |
| link | | varchar(255) | NO | | | |
| link | | varbinary(383) | NO | | | |
| iid | | int unsigned | YES | | NULL | |
| parent | | int unsigned | YES | | NULL | |
| uri-id | Item-uri id of the related post | int unsigned | YES | | NULL | |

View File

@ -8,7 +8,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| -------- | ------------------------------ | ------------------ | ---- | --- | ------------------- | ----- |
| url | page url | varbinary(255) | NO | PRI | NULL | |
| url | page url | varbinary(383) | NO | PRI | NULL | |
| maxwidth | Maximum width passed to Oembed | mediumint unsigned | NO | PRI | NULL | |
| content | OEmbed data of the page | mediumtext | YES | | NULL | |
| created | datetime of creation | datetime | NO | | 0001-01-01 00:00:00 | |

View File

@ -6,18 +6,20 @@ Collection of posts
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| ------ | --------------------------------------------------------- | ---------------- | ---- | --- | ------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| type | 0 - Featured | tinyint unsigned | NO | PRI | 0 | |
| Field | Description | Type | Null | Key | Default | Extra |
| --------- | --------------------------------------------------------- | ---------------- | ---- | --- | ------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| type | 0 - Featured | tinyint unsigned | NO | PRI | 0 | |
| author-id | Author of the featured post | int unsigned | YES | | NULL | |
Indexes
------------
| Name | Fields |
| ------- | ------------ |
| PRIMARY | uri-id, type |
| type | type |
| Name | Fields |
| --------- | ------------ |
| PRIMARY | uri-id, type |
| type | type |
| author-id | author-id |
Foreign Keys
------------
@ -25,5 +27,6 @@ Foreign Keys
| Field | Target Table | Target Field |
|-------|--------------|--------------|
| uri-id | [item-uri](help/database/db_item-uri) | id |
| author-id | [contact](help/database/db_contact) | id |
Return to [database documentation](help/database)

View File

@ -6,25 +6,26 @@ Content for all posts
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------ | ---- | --- | ------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| title | item title | varchar(255) | NO | | | |
| content-warning | | varchar(255) | NO | | | |
| body | item body content | mediumtext | YES | | NULL | |
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
| location | text location where this item originated | varchar(255) | NO | | | |
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
| language | Language information about this post | text | YES | | NULL | |
| app | application which generated this item | varchar(255) | NO | | | |
| rendered-hash | | varchar(32) | NO | | | |
| rendered-html | item.body converted to html | mediumtext | YES | | NULL | |
| object-type | ActivityStreams object type | varchar(100) | NO | | | |
| object | JSON encoded object structure unless it is an implied object (normal post) | text | YES | | NULL | |
| target-type | ActivityStreams target type if applicable (URI) | varchar(100) | NO | | | |
| target | JSON encoded target structure if used | text | YES | | NULL | |
| resource-id | Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type | varchar(32) | NO | | | |
| plink | permalink or URL to a displayable copy of the message at its source | varchar(255) | NO | | | |
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------- | ---- | --- | ------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| title | item title | varchar(255) | NO | | | |
| content-warning | | varchar(255) | NO | | | |
| body | item body content | mediumtext | YES | | NULL | |
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
| quote-uri-id | Id of the item-uri table that contains the quoted uri | int unsigned | YES | | NULL | |
| location | text location where this item originated | varchar(255) | NO | | | |
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
| language | Language information about this post | text | YES | | NULL | |
| app | application which generated this item | varchar(255) | NO | | | |
| rendered-hash | | varchar(32) | NO | | | |
| rendered-html | item.body converted to html | mediumtext | YES | | NULL | |
| object-type | ActivityStreams object type | varchar(100) | NO | | | |
| object | JSON encoded object structure unless it is an implied object (normal post) | text | YES | | NULL | |
| target-type | ActivityStreams target type if applicable (URI) | varchar(100) | NO | | | |
| target | JSON encoded target structure if used | text | YES | | NULL | |
| resource-id | Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type | varchar(32) | NO | | | |
| plink | permalink or URL to a displayable copy of the message at its source | varbinary(383) | NO | | | |
Indexes
------------
@ -35,6 +36,7 @@ Indexes
| plink | plink(191) |
| resource-id | resource-id |
| title-content-warning-body | FULLTEXT, title, content-warning, body |
| quote-uri-id | quote-uri-id |
Foreign Keys
------------
@ -42,5 +44,6 @@ Foreign Keys
| Field | Target Table | Target Field |
|-------|--------------|--------------|
| uri-id | [item-uri](help/database/db_item-uri) | id |
| quote-uri-id | [item-uri](help/database/db_item-uri) | id |
Return to [database documentation](help/database)

View File

@ -6,26 +6,26 @@ Post history
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------ | ---- | --- | ------------------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| edited | Date of edit | datetime | NO | PRI | 0001-01-01 00:00:00 | |
| title | item title | varchar(255) | NO | | | |
| content-warning | | varchar(255) | NO | | | |
| body | item body content | mediumtext | YES | | NULL | |
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
| location | text location where this item originated | varchar(255) | NO | | | |
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
| language | Language information about this post | text | YES | | NULL | |
| app | application which generated this item | varchar(255) | NO | | | |
| rendered-hash | | varchar(32) | NO | | | |
| rendered-html | item.body converted to html | mediumtext | YES | | NULL | |
| object-type | ActivityStreams object type | varchar(100) | NO | | | |
| object | JSON encoded object structure unless it is an implied object (normal post) | text | YES | | NULL | |
| target-type | ActivityStreams target type if applicable (URI) | varchar(100) | NO | | | |
| target | JSON encoded target structure if used | text | YES | | NULL | |
| resource-id | Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type | varchar(32) | NO | | | |
| plink | permalink or URL to a displayable copy of the message at its source | varchar(255) | NO | | | |
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | PRI | NULL | |
| edited | Date of edit | datetime | NO | PRI | 0001-01-01 00:00:00 | |
| title | item title | varchar(255) | NO | | | |
| content-warning | | varchar(255) | NO | | | |
| body | item body content | mediumtext | YES | | NULL | |
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
| location | text location where this item originated | varchar(255) | NO | | | |
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
| language | Language information about this post | text | YES | | NULL | |
| app | application which generated this item | varchar(255) | NO | | | |
| rendered-hash | | varchar(32) | NO | | | |
| rendered-html | item.body converted to html | mediumtext | YES | | NULL | |
| object-type | ActivityStreams object type | varchar(100) | NO | | | |
| object | JSON encoded object structure unless it is an implied object (normal post) | text | YES | | NULL | |
| target-type | ActivityStreams target type if applicable (URI) | varchar(100) | NO | | | |
| target | JSON encoded target structure if used | text | YES | | NULL | |
| resource-id | Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type | varchar(32) | NO | | | |
| plink | permalink or URL to a displayable copy of the message at its source | varbinary(383) | NO | | | |
Indexes
------------

View File

@ -6,36 +6,38 @@ Attached media
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | --------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
| url | Media URL | varbinary(1024) | NO | | NULL | |
| type | Media type | tinyint unsigned | NO | | 0 | |
| mimetype | | varchar(60) | YES | | NULL | |
| height | Height of the media | smallint unsigned | YES | | NULL | |
| width | Width of the media | smallint unsigned | YES | | NULL | |
| size | Media size | bigint unsigned | YES | | NULL | |
| preview | Preview URL | varbinary(512) | YES | | NULL | |
| preview-height | Height of the preview picture | smallint unsigned | YES | | NULL | |
| preview-width | Width of the preview picture | smallint unsigned | YES | | NULL | |
| description | | text | YES | | NULL | |
| name | Name of the media | varchar(255) | YES | | NULL | |
| author-url | URL of the author of the media | varbinary(255) | YES | | NULL | |
| author-name | Name of the author of the media | varchar(255) | YES | | NULL | |
| author-image | Image of the author of the media | varbinary(255) | YES | | NULL | |
| publisher-url | URL of the publisher of the media | varbinary(255) | YES | | NULL | |
| publisher-name | Name of the publisher of the media | varchar(255) | YES | | NULL | |
| publisher-image | Image of the publisher of the media | varbinary(255) | YES | | NULL | |
| Field | Description | Type | Null | Key | Default | Extra |
| --------------- | ------------------------------------------------------------------ | ----------------- | ---- | --- | ------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
| url | Media URL | varbinary(1024) | NO | | NULL | |
| media-uri-id | Id of the item-uri table entry that contains the activities uri-id | int unsigned | YES | | NULL | |
| type | Media type | tinyint unsigned | NO | | 0 | |
| mimetype | | varchar(60) | YES | | NULL | |
| height | Height of the media | smallint unsigned | YES | | NULL | |
| width | Width of the media | smallint unsigned | YES | | NULL | |
| size | Media size | bigint unsigned | YES | | NULL | |
| preview | Preview URL | varbinary(512) | YES | | NULL | |
| preview-height | Height of the preview picture | smallint unsigned | YES | | NULL | |
| preview-width | Width of the preview picture | smallint unsigned | YES | | NULL | |
| description | | text | YES | | NULL | |
| name | Name of the media | varchar(255) | YES | | NULL | |
| author-url | URL of the author of the media | varbinary(383) | YES | | NULL | |
| author-name | Name of the author of the media | varchar(255) | YES | | NULL | |
| author-image | Image of the author of the media | varbinary(383) | YES | | NULL | |
| publisher-url | URL of the publisher of the media | varbinary(383) | YES | | NULL | |
| publisher-name | Name of the publisher of the media | varchar(255) | YES | | NULL | |
| publisher-image | Image of the publisher of the media | varbinary(383) | YES | | NULL | |
Indexes
------------
| Name | Fields |
| ---------- | ------------------------ |
| PRIMARY | id |
| uri-id-url | UNIQUE, uri-id, url(512) |
| uri-id-id | uri-id, id |
| Name | Fields |
| ------------ | ------------------------ |
| PRIMARY | id |
| uri-id-url | UNIQUE, uri-id, url(512) |
| uri-id-id | uri-id, id |
| media-uri-id | media-uri-id |
Foreign Keys
------------
@ -43,5 +45,6 @@ Foreign Keys
| Field | Target Table | Target Field |
|-------|--------------|--------------|
| uri-id | [item-uri](help/database/db_item-uri) | id |
| media-uri-id | [item-uri](help/database/db_item-uri) | id |
Return to [database documentation](help/database)

View File

@ -60,6 +60,7 @@ Indexes
| author-id_uid | author-id, uid |
| author-id_received | author-id, received |
| parent-uri-id_uid | parent-uri-id, uid |
| uid_wall_received | uid, wall, received |
| uid_contactid | uid, contact-id |
| uid_unseen_contactid | uid, unseen, contact-id |
| uid_unseen | uid, unseen |

View File

@ -47,8 +47,8 @@ Fields
| homepage | | varchar(255) | NO | | | |
| xmpp | XMPP address | varchar(255) | NO | | | |
| matrix | Matrix address | varchar(255) | NO | | | |
| photo | | varchar(255) | NO | | | |
| thumb | | varchar(255) | NO | | | |
| photo | | varbinary(383) | NO | | | |
| thumb | | varbinary(383) | NO | | | |
| publish | publish default profile in local directory | boolean | NO | | 0 | |
| net-publish | publish profile in global directory | boolean | NO | | 0 | |

View File

@ -10,7 +10,7 @@ Fields
| ------------ | --------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uid | User id | mediumint unsigned | NO | | 0 | |
| callback_url | | varchar(255) | NO | | | |
| callback_url | | varbinary(383) | NO | | | |
| topic | | varchar(255) | NO | | | |
| nickname | | varchar(255) | NO | | | |
| push | Retrial counter | tinyint | NO | | 0 | |

View File

@ -9,7 +9,7 @@ Fields
| Field | Description | Type | Null | Key | Default | Extra |
| -------- | ------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| hash | | varchar(255) | NO | | | |
| hash | | varbinary(255) | NO | | | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
| uid | User id | mediumint unsigned | NO | | 0 | |
| password | | varchar(255) | NO | | | |

View File

@ -10,7 +10,7 @@ Fields
| ----- | ----------------------------------------------------------------------------- | ---------------- | ---- | --- | ------- | -------------- |
| id | | int unsigned | NO | PRI | NULL | auto_increment |
| name | | varchar(96) | NO | | | |
| url | | varbinary(255) | NO | | | |
| url | | varbinary(383) | NO | | | |
| type | Type of the tag (Unknown, General Collection, Follower Collection or Account) | tinyint unsigned | YES | | NULL | |
Indexes

View File

@ -24,7 +24,7 @@ Fields
| fetch_further_information | | tinyint unsigned | YES | | NULL | |
| ffi_keyword_denylist | | text | YES | | NULL | |
| subhub | | boolean | YES | | NULL | |
| hub-verify | | varchar(255) | YES | | NULL | |
| hub-verify | | varbinary(383) | YES | | NULL | |
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | |
| priority | Feed poll priority | tinyint unsigned | YES | | NULL | |

View File

@ -405,6 +405,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('block', $hook_data);
Hook::callAll('unblock', $hook_data);
### src/Core/Logger/Factory.php
Hook::callAll('logger_instance', $data);
### src/Core/StorageManager
Hook::callAll('storage_instance', $data);

View File

@ -31,7 +31,7 @@ Requirements
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
* Einen E-Mail Server, so dass PHP `mail()` funktioniert.
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden.
* Mysql 5.6+ (oder eine äquivalente Alternative: MariaDB, Percona Server etc.)
* Mysql Server mit Unterstützung vom InnoDB und Barracuda (wir empfehlen MariaDB da die Entwicklung mit solchen Server erfolgt, aber Alternativen wie MySQL, Percona Server etc. sollten auch funktionieren)
* die Möglichkeit, wiederkehrende Aufgaben mit cron (Linux/Mac) oder "Scheduled Tasks" einzustellen (Windows) [Beachte: andere Optionen sind in Abschnitt 7 dieser Dokumentation zu finden]
* Installation in einer Top-Level-Domain oder Subdomain (ohne eine Verzeichnis/Pfad-Komponente in der URL) wird bevorzugt. Verzeichnispfade sind für diesen Zweck nicht so günstig und wurden auch nicht ausführlich getestet.

View File

@ -123,13 +123,13 @@ The selected 1st part will be saved in the database by the theme_post function.
function theme_post(App $a){
// non local users shall not pass
if (! local_user()) {
if (!Session::getLocalUser()) {
return;
}
// if the one specific submit button was pressed then proceed
if (isset($_POST['duepuntozero-settings-submit'])){
// and save the selection key into the personal config of the user
DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
@ -137,7 +137,7 @@ Now that this information is set in the database, what should friendica do with
For this, have a look at the theme.php file of the *duepunto zero*.
There you'll find somethink alike
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
$colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero','colorset');
if (!$colorset)
$colorset = DI::config()->get('duepuntozero', 'colorset');
if ($colorset) {

View File

@ -27,7 +27,6 @@ use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -42,7 +41,7 @@ use Friendica\Util\Temporal;
function cal_init(App $a)
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
@ -112,14 +111,14 @@ function cal_content(App $a)
$owner_uid = intval($owner['uid']);
$nick = $owner['nickname'];
$contact_id = Session::getRemoteContactID($owner['uid']);
$contact_id = DI::userSession()->getRemoteContactID($owner['uid']);
$remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $owner['uid']]);
$is_owner = local_user() == $owner['uid'];
$is_owner = DI::userSession()->getLocalUserId() == $owner['uid'];
if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
notice(DI::l10n()->t('Access to this profile has been restricted.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
return;
}
@ -262,7 +261,7 @@ function cal_content(App $a)
if ($mode == 'export') {
if (!$owner_uid) {
notice(DI::l10n()->t('User not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
return;
}
@ -271,14 +270,14 @@ function cal_content(App $a)
if (!$evexport["success"]) {
if ($evexport["content"]) {
notice(DI::l10n()->t('This calendar format is not supported'));
DI::sysmsg()->addNotice(DI::l10n()->t('This calendar format is not supported'));
} else {
notice(DI::l10n()->t('No exportable data found'));
DI::sysmsg()->addNotice(DI::l10n()->t('No exportable data found'));
}
// If it the own calendar return to the events page
// otherwise to the profile calendar page
if (local_user() === $owner_uid) {
if (DI::userSession()->getLocalUserId() === $owner_uid) {
$return_path = "events";
} else {
$return_path = "cal/" . $nick;

View File

@ -24,7 +24,6 @@ use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -46,14 +45,14 @@ function display_init(App $a)
(new Objects(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), $_SERVER, ['guid' => DI::args()->getArgv()[1] ?? null]))->run();
}
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
return;
}
$nick = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
$item = null;
$item_user = local_user();
$item_user = DI::userSession()->getLocalUserId();
$fields = ['uri-id', 'parent-uri-id', 'author-id', 'author-link', 'body', 'uid', 'guid', 'gravity'];
@ -62,18 +61,18 @@ function display_init(App $a)
$nick = '';
// Does the local user have this item?
if (local_user()) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()]);
if (DI::userSession()->getLocalUserId()) {
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => DI::userSession()->getLocalUserId()]);
if (DBA::isResult($item)) {
$nick = $a->getLoggedInUserNickname();
}
}
// Is this item private but could be visible to the remove visitor?
if (!DBA::isResult($item) && remote_user()) {
if (!DBA::isResult($item) && DI::userSession()->getRemoteUserId()) {
$item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
if (DBA::isResult($item)) {
if (!Contact::isFollower(remote_user(), $item['uid'])) {
if (!Contact::isFollower(DI::userSession()->getRemoteUserId(), $item['uid'])) {
$item = null;
} else {
$item_user = $item['uid'];
@ -83,14 +82,14 @@ function display_init(App $a)
// Is it an item with uid=0?
if (!DBA::isResult($item)) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['guid' => DI::args()->getArgv()[1], 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
}
} elseif (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
$uri_id = DI::args()->getArgv()[2];
if (substr($uri_id, -5) == '.atom') {
$uri_id = substr($uri_id, 0, -5);
}
$item = Post::selectFirstForUser(local_user(), $fields, ['uri-id' => $uri_id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['uri-id' => $uri_id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
}
if (!DBA::isResult($item)) {
@ -102,11 +101,11 @@ function display_init(App $a)
}
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
Logger::info('Directly serving XML for uri-id '.$item['uri-id']);
Logger::debug('Directly serving XML', ['uri-id' => $item['uri-id']]);
displayShowFeed($item['uri-id'], $item['uid'], false);
}
if ($item['gravity'] != GRAVITY_PARENT) {
if ($item['gravity'] != Item::GRAVITY_PARENT) {
$parent = Post::selectFirstForUser($item_user, $fields, ['uid' => [0, $item_user], 'uri-id' => $item['parent-uri-id']], ['order' => ['uid' => true]]);
$item = $parent ?: $item;
}
@ -123,11 +122,9 @@ function display_init(App $a)
function display_fetchauthor($item)
{
if (Diaspora::isReshare($item['body'], true)) {
$shared = Item::getShareArray($item);
if (!empty($shared['profile'])) {
$contact = Contact::getByURLForUser($shared['profile'], local_user());
}
$shared = DI::contentItem()->getSharedPost($item, ['author-link']);
if (!empty($shared) && empty($shared['comment'])) {
$contact = Contact::getByURLForUser($shared['post']['author-link'], DI::userSession()->getLocalUserId());
}
if (empty($contact)) {
@ -139,7 +136,7 @@ function display_fetchauthor($item)
function display_content(App $a, $update = false, $update_uid = 0)
{
if (DI::config()->get('system','block_public') && !Session::isAuthenticated()) {
if (DI::config()->get('system','block_public') && !DI::userSession()->isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
}
@ -181,18 +178,18 @@ function display_content(App $a, $update = false, $update_uid = 0)
if (DI::args()->getArgc() == 2) {
$fields = ['uri-id', 'parent-uri-id', 'uid'];
if (local_user()) {
$condition = ['guid' => DI::args()->getArgv()[1], 'uid' => [0, local_user()]];
$item = Post::selectFirstForUser(local_user(), $fields, $condition, ['order' => ['uid' => true]]);
if (DI::userSession()->getLocalUserId()) {
$condition = ['guid' => DI::args()->getArgv()[1], 'uid' => [0, DI::userSession()->getLocalUserId()]];
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, $condition, ['order' => ['uid' => true]]);
if (DBA::isResult($item)) {
$uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id'];
}
}
if (($parent_uri_id == 0) && remote_user()) {
if (($parent_uri_id == 0) && DI::userSession()->getRemoteUserId()) {
$item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
if (DBA::isResult($item) && Contact::isFollower(DI::userSession()->getRemoteUserId(), $item['uid'])) {
$uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id'];
}
@ -200,7 +197,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
if ($parent_uri_id == 0) {
$condition = ['private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => DI::args()->getArgv()[1], 'uid' => 0];
$item = Post::selectFirstForUser(local_user(), $fields, $condition);
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, $condition);
if (DBA::isResult($item)) {
$uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id'];
@ -213,9 +210,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));
}
if (!DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
DI::notification()->setAllSeenForUser(local_user(), ['parent-uri-id' => $item['parent-uri-id']]);
DI::notify()->setAllSeenForUser(local_user(), ['parent-uri-id' => $item['parent-uri-id']]);
if (!DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'detailed_notif')) {
DI::notification()->setAllSeenForUser(DI::userSession()->getLocalUserId(), ['parent-uri-id' => $item['parent-uri-id']]);
DI::notify()->setAllSeenForUser(DI::userSession()->getLocalUserId(), ['parent-uri-id' => $item['parent-uri-id']]);
}
// We are displaying an "alternate" link if that post was public. See issue 2864
@ -234,17 +231,17 @@ function display_content(App $a, $update = false, $update_uid = 0)
'$conversation' => $conversation]);
$is_remote_contact = false;
$item_uid = local_user();
$item_uid = DI::userSession()->getLocalUserId();
$page_uid = 0;
$parent = null;
if (!local_user() && !empty($parent_uri_id)) {
if (!DI::userSession()->getLocalUserId() && !empty($parent_uri_id)) {
$parent = Post::selectFirst(['uid'], ['uri-id' => $parent_uri_id, 'wall' => true]);
}
if (DBA::isResult($parent)) {
$page_uid = $page_uid ?? 0 ?: $parent['uid'];
$is_remote_contact = Session::getRemoteContactID($page_uid);
$is_remote_contact = DI::userSession()->getRemoteContactID($page_uid);
if ($is_remote_contact) {
$item_uid = $parent['uid'];
}
@ -252,11 +249,11 @@ function display_content(App $a, $update = false, $update_uid = 0)
$page_uid = $item['uid'];
}
if (!empty($page_uid) && ($page_uid != local_user())) {
if (!empty($page_uid) && ($page_uid != DI::userSession()->getLocalUserId())) {
$page_user = User::getById($page_uid);
}
$is_owner = local_user() && (in_array($page_uid, [local_user(), 0]));
$is_owner = DI::userSession()->getLocalUserId() && (in_array($page_uid, [DI::userSession()->getLocalUserId(), 0]));
if (!empty($page_user['hidewall']) && !$is_owner && !$is_remote_contact) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
@ -268,8 +265,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
$sql_extra = Item::getPermissionsSQLByUserId($page_uid);
if (local_user() && (local_user() == $page_uid)) {
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true];
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $page_uid)) {
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => DI::userSession()->getLocalUserId(), 'unseen' => true];
$unseen = Post::exists($condition);
} else {
$unseen = false;
@ -290,11 +287,11 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item['uri-id'] = $item['parent-uri-id'];
if ($unseen) {
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true];
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => DI::userSession()->getLocalUserId(), 'unseen' => true];
Item::update(['unseen' => false], $condition);
}
if (!$update && local_user()) {
if (!$update && DI::userSession()->getLocalUserId()) {
$o .= "<script> var netargs = '?uri_id=" . $item['uri-id'] . "'; </script>";
}

View File

@ -34,29 +34,29 @@ function editpost_content(App $a)
{
$o = '';
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id) {
notice(DI::l10n()->t('Item not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return;
}
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'];
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['id' => $post_id, 'uid' => DI::userSession()->getLocalUserId()]);
if (!DBA::isResult($item)) {
notice(DI::l10n()->t('Item not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return;
}
$user = User::getById(local_user());
$user = User::getById(DI::userSession()->getLocalUserId());
$geotag = '';
@ -118,8 +118,8 @@ function editpost_content(App $a)
'$jotnets' => $jotnets,
'$title' => $item['title'],
'$placeholdertitle' => DI::l10n()->t('Set title'),
'$category' => Post\Category::getCSVByURIId($item['uri-id'], local_user(), Post\Category::CATEGORY),
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''),
'$category' => Post\Category::getCSVByURIId($item['uri-id'], DI::userSession()->getLocalUserId(), Post\Category::CATEGORY),
'$placeholdercategory' => (Feature::isEnabled(DI::userSession()->getLocalUserId(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''),
'$emtitle' => DI::l10n()->t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),

View File

@ -46,7 +46,7 @@ use Friendica\Worker\Delivery;
function events_init(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
return;
}
@ -54,7 +54,7 @@ function events_init(App $a)
DI::page()['aside'] = '';
}
$cal_widget = CalendarExport::getHTML(local_user());
$cal_widget = CalendarExport::getHTML(DI::userSession()->getLocalUserId());
DI::page()['aside'] .= $cal_widget;
@ -64,13 +64,13 @@ function events_init(App $a)
function events_post(App $a)
{
Logger::debug('post', ['request' => $_REQUEST]);
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
return;
}
$event_id = !empty($_POST['event_id']) ? intval($_POST['event_id']) : 0;
$cid = !empty($_POST['cid']) ? intval($_POST['cid']) : 0;
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$start_text = Strings::escapeHtml($_REQUEST['start_text'] ?? '');
$finish_text = Strings::escapeHtml($_REQUEST['finish_text'] ?? '');
@ -121,7 +121,7 @@ function events_post(App $a)
$onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
if (strcmp($finish, $start) < 0 && !$nofinish) {
notice(DI::l10n()->t('Event can not end before it has started.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Event can not end before it has started.'));
if (intval($_REQUEST['preview'])) {
System::httpExit(DI::l10n()->t('Event can not end before it has started.'));
}
@ -129,7 +129,7 @@ function events_post(App $a)
}
if (!$summary || ($start === DBA::NULL_DATETIME)) {
notice(DI::l10n()->t('Event title and start time are required.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Event title and start time are required.'));
if (intval($_REQUEST['preview'])) {
System::httpExit(DI::l10n()->t('Event title and start time are required.'));
}
@ -173,22 +173,23 @@ function events_post(App $a)
$private_event = true;
}
$datarray = [];
$datarray['start'] = $start;
$datarray['finish'] = $finish;
$datarray['summary'] = $summary;
$datarray['desc'] = $desc;
$datarray['location'] = $location;
$datarray['type'] = $type;
$datarray['nofinish'] = $nofinish;
$datarray['uid'] = $uid;
$datarray['cid'] = $cid;
$datarray['allow_cid'] = $str_contact_allow;
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
$datarray['private'] = $private_event;
$datarray['id'] = $event_id;
$datarray = [
'start' => $start,
'finish' => $finish,
'summary' => $summary,
'desc' => $desc,
'location' => $location,
'type' => $type,
'nofinish' => $nofinish,
'uid' => $uid,
'cid' => $cid,
'allow_cid' => $str_contact_allow,
'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny,
'deny_gid' => $str_group_deny,
'private' => $private_event,
'id' => $event_id,
];
if (intval($_REQUEST['preview'])) {
System::httpExit(Event::getHTML($datarray));
@ -205,7 +206,7 @@ function events_post(App $a)
}
if (!$cid && $uri_id) {
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
}
DI::baseUrl()->redirect('events');
@ -213,8 +214,8 @@ function events_post(App $a)
function events_content(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form();
}
@ -223,11 +224,11 @@ function events_content(App $a)
}
if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'ignore') && intval(DI::args()->getArgv()[2])) {
DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
}
if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'unignore') && intval(DI::args()->getArgv()[2])) {
DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
}
if ($a->getThemeInfoValue('events_in_profile')) {
@ -322,9 +323,9 @@ function events_content(App $a)
// get events by id or by date
if ($event_params['event_id']) {
$r = Event::getListById(local_user(), $event_params['event_id']);
$r = Event::getListById(DI::userSession()->getLocalUserId(), $event_params['event_id']);
} else {
$r = Event::getListByDate(local_user(), $event_params);
$r = Event::getListByDate(DI::userSession()->getLocalUserId(), $event_params);
}
$links = [];
@ -395,7 +396,7 @@ function events_content(App $a)
}
if (($mode === 'edit' || $mode === 'copy') && $event_id) {
$orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => local_user()]);
$orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => DI::userSession()->getLocalUserId()]);
}
// Passed parameters overrides anything found in the DB
@ -404,8 +405,8 @@ function events_content(App $a)
$share_disabled = '';
if (empty($orig_event)) {
$orig_event = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);;
} elseif ($orig_event['allow_cid'] !== '<' . local_user() . '>'
$orig_event = User::getById(DI::userSession()->getLocalUserId(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);;
} elseif ($orig_event['allow_cid'] !== '<' . DI::userSession()->getLocalUserId() . '>'
|| $orig_event['allow_gid']
|| $orig_event['deny_cid']
|| $orig_event['deny_gid']) {
@ -523,15 +524,15 @@ function events_content(App $a)
// Remove an event from the calendar and its related items
if ($mode === 'drop' && $event_id) {
$ev = Event::getListById(local_user(), $event_id);
$ev = Event::getListById(DI::userSession()->getLocalUserId(), $event_id);
// Delete only real events (no birthdays)
if (DBA::isResult($ev) && $ev[0]['type'] == 'event') {
Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
Item::deleteForUser(['id' => $ev[0]['itemid']], DI::userSession()->getLocalUserId());
}
if (Post::exists(['id' => $ev[0]['itemid']])) {
notice(DI::l10n()->t('Failed to remove event'));
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to remove event'));
}
DI::baseUrl()->redirect('events');

View File

@ -38,7 +38,7 @@ use Friendica\Util\Strings;
*/
function fbrowser_content(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
System::exit();
}
@ -65,7 +65,7 @@ function fbrowser_content(App $a)
if (DI::args()->getArgc() == 2) {
$photos = DBA::toArray(DBA::p("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = ? AND NOT `photo-type` IN (?, ?)",
local_user(),
DI::userSession()->getLocalUserId(),
Photo::CONTACT_AVATAR,
Photo::CONTACT_BANNER
));
@ -84,7 +84,7 @@ function fbrowser_content(App $a)
min(`scale`) AS `hiq`, max(`scale`) AS `loq`, ANY_VALUE(`desc`) AS `desc`, ANY_VALUE(`created`) AS `created`
FROM `photo` WHERE `uid` = ? $sql_extra AND NOT `photo-type` IN (?, ?)
GROUP BY `resource-id` $sql_extra2",
local_user(),
DI::userSession()->getLocalUserId(),
Photo::CONTACT_AVATAR,
Photo::CONTACT_BANNER
));
@ -103,7 +103,8 @@ function fbrowser_content(App $a)
return [
DI::baseUrl() . '/photos/' . $a->getLoggedInUserNickname() . '/image/' . $rr['resource-id'],
$filename_e,
DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext,
$rr['desc']
];
}
$files = array_map("_map_files1", $r);
@ -123,7 +124,7 @@ function fbrowser_content(App $a)
break;
case "file":
if (DI::args()->getArgc()==2) {
$files = DBA::selectToArray('attach', ['id', 'filename', 'filetype'], ['uid' => local_user()]);
$files = DBA::selectToArray('attach', ['id', 'filename', 'filetype'], ['uid' => DI::userSession()->getLocalUserId()]);
function _map_files2($rr)
{

View File

@ -35,7 +35,7 @@ use Friendica\Util\Strings;
function follow_post(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
@ -52,13 +52,13 @@ function follow_content(App $a)
{
$return_path = 'contact';
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$url = Probe::cleanURI(trim($_REQUEST['url'] ?? ''));
@ -81,7 +81,7 @@ function follow_content(App $a)
if (DBA::isResult($user_contact)) {
if ($user_contact['pending']) {
notice(DI::l10n()->t('You already added this contact.'));
DI::sysmsg()->addNotice(DI::l10n()->t('You already added this contact.'));
$submit = '';
}
}
@ -97,7 +97,7 @@ function follow_content(App $a)
// Possibly it is a remote item and not an account
follow_remote_item($url);
notice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
DI::sysmsg()->addNotice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
$submit = '';
$contact = ['url' => $url, 'network' => Protocol::PHANTOM, 'name' => $url, 'keywords' => ''];
}
@ -105,12 +105,12 @@ function follow_content(App $a)
$protocol = Contact::getProtocol($contact['url'], $contact['network']);
if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) {
notice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
DI::sysmsg()->addNotice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
$submit = '';
}
if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) {
notice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
DI::sysmsg()->addNotice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
$submit = '';
}
@ -127,7 +127,7 @@ function follow_content(App $a)
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
@ -181,21 +181,21 @@ function follow_process(App $a, string $url)
follow_remote_item($url);
if ($result['message']) {
notice($result['message']);
DI::sysmsg()->addNotice($result['message']);
}
DI::baseUrl()->redirect($return_path);
} elseif ($result['cid']) {
DI::baseUrl()->redirect('contact/' . $result['cid']);
}
notice(DI::l10n()->t('The contact could not be added.'));
DI::sysmsg()->addNotice(DI::l10n()->t('The contact could not be added.'));
DI::baseUrl()->redirect($return_path);
}
function follow_remote_item($url)
{
$item_id = Item::fetchByLink($url, local_user());
$item_id = Item::fetchByLink($url, DI::userSession()->getLocalUserId());
if (!$item_id) {
// If the user-specific search failed, we search and probe a public post
$item_id = Item::fetchByLink($url);

View File

@ -34,8 +34,8 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Attach;
@ -57,11 +57,11 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\ParseUrl;
function item_post(App $a) {
if (!Session::isAuthenticated()) {
if (!DI::userSession()->isAuthenticated()) {
throw new HTTPException\ForbiddenException();
}
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
if (!empty($_REQUEST['dropitems'])) {
$arr_drop = explode(',', $_REQUEST['dropitems']);
@ -89,7 +89,7 @@ function item_post(App $a) {
*/
if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
Logger::info('item post: duplicate post');
Logger::warning('duplicate post');
item_post_return(DI::baseUrl(), $api_source, $return_path);
} else {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
@ -106,7 +106,7 @@ function item_post(App $a) {
$toplevel_user_id = null;
$objecttype = null;
$profile_uid = ($_REQUEST['profile_uid'] ?? 0) ?: local_user();
$profile_uid = ($_REQUEST['profile_uid'] ?? 0) ?: DI::userSession()->getLocalUserId();
$posttype = ($_REQUEST['post_type'] ?? '') ?: Item::PT_ARTICLE;
if ($parent_item_id || $thr_parent_uri) {
@ -122,13 +122,13 @@ function item_post(App $a) {
$thr_parent_uri = $parent_item['uri'];
$toplevel_item = $parent_item;
if ($parent_item['gravity'] != GRAVITY_PARENT) {
if ($parent_item['gravity'] != Item::GRAVITY_PARENT) {
$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $toplevel_item['parent']]);
}
}
if (!DBA::isResult($toplevel_item)) {
notice(DI::l10n()->t('Unable to locate original post.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate original post.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -138,7 +138,7 @@ function item_post(App $a) {
// When commenting on a public post then store the post for the current user
// This enables interaction like starring and saving into folders
if ($toplevel_item['uid'] == 0) {
$stored = Item::storeForUserByUriId($toplevel_item['uri-id'], local_user(), ['post-reason' => Item::PR_ACTIVITY]);
$stored = Item::storeForUserByUriId($toplevel_item['uri-id'], DI::userSession()->getLocalUserId(), ['post-reason' => Item::PR_ACTIVITY]);
Logger::info('Public item stored for user', ['uri-id' => $toplevel_item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
if ($stored) {
$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $stored]);
@ -168,17 +168,17 @@ function item_post(App $a) {
}
// Ensure that the user id in a thread always stay the same
if (!is_null($toplevel_user_id) && in_array($toplevel_user_id, [local_user(), 0])) {
if (!is_null($toplevel_user_id) && in_array($toplevel_user_id, [DI::userSession()->getLocalUserId(), 0])) {
$profile_uid = $toplevel_user_id;
}
// Allow commenting if it is an answer to a public post
$allow_comment = local_user() && $toplevel_item_id && in_array($toplevel_item['private'], [Item::PUBLIC, Item::UNLISTED]) && in_array($toplevel_item['network'], Protocol::FEDERATED);
$allow_comment = DI::userSession()->getLocalUserId() && $toplevel_item_id && in_array($toplevel_item['private'], [Item::PUBLIC, Item::UNLISTED]) && in_array($toplevel_item['network'], Protocol::FEDERATED);
// Now check that valid personal details have been provided
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
Logger::notice('Permission denied.', ['local' => local_user(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
notice(DI::l10n()->t('Permission denied.'));
Logger::warning('Permission denied.', ['local' => DI::userSession()->getLocalUserId(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -307,7 +307,7 @@ function item_post(App $a) {
// for non native networks use the network of the original post as network of the item
if (($toplevel_item['network'] != Protocol::DIASPORA)
&& ($toplevel_item['network'] != Protocol::OSTATUS)
&& ($network == "")) {
&& ($network == '')) {
$network = $toplevel_item['network'];
}
@ -323,9 +323,9 @@ function item_post(App $a) {
$pubmail_enabled = ($_REQUEST['pubmail_enable'] ?? false) && !$private;
// if using the API, we won't see pubmail_enable - figure out if it should be set
if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
if ($api_source && $profile_uid && $profile_uid == DI::userSession()->getLocalUserId() && !$private) {
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", DI::userSession()->getLocalUserId(), '']);
}
}
@ -334,7 +334,7 @@ function item_post(App $a) {
System::jsonExit(['preview' => '']);
}
notice(DI::l10n()->t('Empty post discarded.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Empty post discarded.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -362,11 +362,11 @@ function item_post(App $a) {
$self = false;
$contact_id = 0;
if (local_user() && ((local_user() == $profile_uid) || $allow_comment)) {
if (DI::userSession()->getLocalUserId() && ((DI::userSession()->getLocalUserId() == $profile_uid) || $allow_comment)) {
$self = true;
$author = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
} elseif (!empty(Session::getRemoteContactID($profile_uid))) {
$author = DBA::selectFirst('contact', [], ['id' => Session::getRemoteContactID($profile_uid)]);
$author = DBA::selectFirst('contact', [], ['uid' => DI::userSession()->getLocalUserId(), 'self' => true]);
} elseif (!empty(DI::userSession()->getRemoteContactID($profile_uid))) {
$author = DBA::selectFirst('contact', [], ['id' => DI::userSession()->getRemoteContactID($profile_uid)]);
}
if (DBA::isResult($author)) {
@ -374,7 +374,7 @@ function item_post(App $a) {
}
// get contact info for owner
if ($profile_uid == local_user() || $allow_comment) {
if ($profile_uid == DI::userSession()->getLocalUserId() || $allow_comment) {
$contact_record = $author ?: [];
} else {
$contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]) ?: [];
@ -384,8 +384,8 @@ function item_post(App $a) {
if ($posttype != Item::PT_PERSONAL_NOTE) {
// Look for any tags and linkify them
$item = [
'uid' => local_user() ? local_user() : $profile_uid,
'gravity' => $toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT,
'uid' => DI::userSession()->getLocalUserId() ? DI::userSession()->getLocalUserId() : $profile_uid,
'gravity' => $toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT,
'network' => $network,
'body' => $body,
'postopts' => $postopts,
@ -401,7 +401,7 @@ function item_post(App $a) {
$body = $item['body'];
$inform = $item['inform'];
$postopts = $item['postopts'];
$private = $item['private'];
$private = $item['private'];
$str_contact_allow = $item['allow_cid'];
$str_group_allow = $item['allow_gid'];
$str_contact_deny = $item['deny_cid'];
@ -462,7 +462,7 @@ function item_post(App $a) {
$data = BBCode::getAttachmentData($body);
$match = [];
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
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\ObjectType::BOOKMARK;
@ -477,11 +477,11 @@ function item_post(App $a) {
$objecttype = Activity\ObjectType::NOTE; // Default value
$objectdata = BBCode::getAttachedData($body);
if ($objectdata["type"] == "link") {
if ($objectdata['type'] == 'link') {
$objecttype = Activity\ObjectType::BOOKMARK;
} elseif ($objectdata["type"] == "video") {
} elseif ($objectdata['type'] == 'video') {
$objecttype = Activity\ObjectType::VIDEO;
} elseif ($objectdata["type"] == "photo") {
} elseif ($objectdata['type'] == 'photo') {
$objecttype = Activity\ObjectType::IMAGE;
}
@ -509,11 +509,11 @@ function item_post(App $a) {
$verb = Activity::POST;
}
if ($network == "") {
if ($network == '') {
$network = Protocol::DFRN;
}
$gravity = ($toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT);
$gravity = ($toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT);
// even if the post arrived via API we are considering that it
// originated on this site by default for determining relayability.
@ -532,77 +532,67 @@ function item_post(App $a) {
$thr_parent_uri = $uri;
}
$datarray = [];
$datarray['uid'] = $profile_uid;
$datarray['wall'] = $wall;
$datarray['gravity'] = $gravity;
$datarray['network'] = $network;
$datarray['contact-id'] = $contact_id;
$datarray['owner-name'] = $contact_record['name'] ?? '';
$datarray['owner-link'] = $contact_record['url'] ?? '';
$datarray['owner-avatar'] = $contact_record['thumb'] ?? '';
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
$datarray['author-name'] = $author['name'];
$datarray['author-link'] = $author['url'];
$datarray['author-avatar'] = $author['thumb'];
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
$datarray['created'] = empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'];
$datarray['edited'] = $datarray['created'];
$datarray['commented'] = $datarray['created'];
$datarray['changed'] = $datarray['created'];
$datarray['received'] = DateTimeFormat::utcNow();
$datarray['extid'] = $extid;
$datarray['guid'] = $guid;
$datarray['uri'] = $uri;
$datarray['title'] = $title;
$datarray['body'] = $body;
$datarray['app'] = $app;
$datarray['location'] = $location;
$datarray['coord'] = $coord;
$datarray['file'] = $categories;
$datarray['inform'] = $inform;
$datarray['verb'] = $verb;
$datarray['post-type'] = $posttype;
$datarray['object-type'] = $objecttype;
$datarray['allow_cid'] = $str_contact_allow;
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enabled;
$datarray['attach'] = $attachments;
$datarray = [
'uid' => $profile_uid,
'wall' => $wall,
'gravity' => $gravity,
'network' => $network,
'contact-id' => $contact_id,
'owner-name' => $contact_record['name'] ?? '',
'owner-link' => $contact_record['url'] ?? '',
'owner-avatar' => $contact_record['thumb'] ?? '',
'author-name' => $author['name'],
'author-link' => $author['url'],
'author-avatar' => $author['thumb'],
'created' => empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'],
'received' => DateTimeFormat::utcNow(),
'extid' => $extid,
'guid' => $guid,
'uri' => $uri,
'title' => $title,
'body' => $body,
'app' => $app,
'location' => $location,
'coord' => $coord,
'file' => $categories,
'inform' => $inform,
'verb' => $verb,
'post-type' => $posttype,
'object-type' => $objecttype,
'allow_cid' => $str_contact_allow,
'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny,
'deny_gid' => $str_group_deny,
'private' => $private,
'pubmail' => $pubmail_enabled,
'attach' => $attachments,
'thr-parent' => $thr_parent_uri,
'postopts' => $postopts,
'origin' => $origin,
'object' => $object,
'attachments' => $_REQUEST['attachments'] ?? [],
/*
* These fields are for the convenience of addons...
* 'self' if true indicates the owner is posting on their own wall
* If parent is 0 it is a top-level post.
*/
'parent' => $toplevel_item_id,
'self' => $self,
// This triggers posts via API and the mirror functions
'api_source' => $api_source,
// This field is for storing the raw conversation data
'protocol' => Conversation::PARCEL_DIRECT,
'direction' => Conversation::PUSH,
];
$datarray['thr-parent'] = $thr_parent_uri;
// These cannot be part of above initialization ...
$datarray['edited'] = $datarray['created'];
$datarray['commented'] = $datarray['created'];
$datarray['changed'] = $datarray['created'];
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
$datarray['postopts'] = $postopts;
$datarray['origin'] = $origin;
$datarray['object'] = $object;
$datarray['attachments'] = $_REQUEST['attachments'] ?? [];
/*
* These fields are for the convenience of addons...
* 'self' if true indicates the owner is posting on their own wall
* If parent is 0 it is a top-level post.
*/
$datarray['parent'] = $toplevel_item_id;
$datarray['self'] = $self;
// This triggers posts via API and the mirror functions
$datarray['api_source'] = $api_source;
// This field is for storing the raw conversation data
$datarray['protocol'] = Conversation::PARCEL_DIRECT;
$datarray['direction'] = Conversation::PUSH;
if ($orig_post) {
$datarray['edit'] = true;
} else {
// If this was a share, add missing data here
$datarray = Item::addShareDataFromOriginal($datarray);
$datarray['edit'] = false;
}
$datarray['edit'] = $orig_post;
// Check for hashtags in the body and repair or add hashtag links
if ($preview || $orig_post) {
@ -613,14 +603,16 @@ function item_post(App $a) {
if ($preview) {
// We set the datarray ID to -1 because in preview mode the dataray
// doesn't have an ID.
$datarray["id"] = -1;
$datarray["uri-id"] = -1;
$datarray["author-network"] = Protocol::DFRN;
$datarray["author-updated"] = '';
$datarray["author-gsid"] = 0;
$datarray["author-uri-id"] = ItemURI::getIdByURI($datarray["author-link"]);
$datarray["owner-updated"] = '';
$datarray["has-media"] = false;
$datarray['id'] = -1;
$datarray['uri-id'] = -1;
$datarray['author-network'] = Protocol::DFRN;
$datarray['author-updated'] = '';
$datarray['author-gsid'] = 0;
$datarray['author-uri-id'] = ItemURI::getIdByURI($datarray['author-link']);
$datarray['owner-updated'] = '';
$datarray['has-media'] = false;
$datarray['quote-uri-id'] = Item::getQuoteUriId($datarray['body'], $datarray['uid']);
$datarray['body'] = BBCode::removeSharedData($datarray['body']);
$o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
@ -641,7 +633,7 @@ function item_post(App $a) {
unset($datarray['self']);
unset($datarray['api_source']);
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
Post\Delayed::add($datarray['uri'], $datarray, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
item_post_return(DI::baseUrl(), $api_source, $return_path);
}
}
@ -662,13 +654,19 @@ function item_post(App $a) {
$datarray['uri-id'] = ItemURI::getIdByURI($datarray['uri']);
if ($orig_post) {
$quote_uri_id = Item::getQuoteUriId($datarray['body'], $datarray['uid']);
if (!empty($quote_uri_id)) {
$datarray['quote-uri-id'] = $quote_uri_id;
$datarray['body'] = BBCode::removeSharedData($datarray['body']);
}
if ($orig_post) {
$fields = [
'title' => $datarray['title'],
'body' => $datarray['body'],
'attach' => $datarray['attach'],
'file' => $datarray['file'],
'edited' => DateTimeFormat::utcNow(),
'title' => $datarray['title'],
'body' => $datarray['body'],
'attach' => $datarray['attach'],
'file' => $datarray['file'],
'edited' => DateTimeFormat::utcNow(),
'changed' => DateTimeFormat::utcNow()
];
@ -689,7 +687,7 @@ function item_post(App $a) {
$post_id = Item::insert($datarray);
if (!$post_id) {
notice(DI::l10n()->t('Item wasn\'t stored.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Item wasn\'t stored.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -710,7 +708,7 @@ function item_post(App $a) {
Tag::storeFromBody($datarray['uri-id'], $datarray['body']);
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == GRAVITY_COMMENT)) {
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == Item::GRAVITY_COMMENT)) {
Tag::createImplicitMentions($datarray['uri-id'], $datarray['thr-parent-id']);
}
@ -741,7 +739,7 @@ function item_post(App $a) {
Hook::callAll('post_local_end', $datarray);
if (strlen($emailcc) && $profile_uid == local_user()) {
if (strlen($emailcc) && $profile_uid == DI::userSession()->getLocalUserId()) {
$recipients = explode(',', $emailcc);
if (count($recipients)) {
foreach ($recipients as $recipient) {
@ -755,7 +753,7 @@ function item_post(App $a) {
}
}
Logger::info('post_complete');
Logger::debug('post_complete');
if ($api_source) {
return $post_id;
@ -780,14 +778,14 @@ function item_post_return($baseurl, $api_source, $return_path)
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}
Logger::info('post_json', ['json' => $json]);
Logger::debug('post_json', ['json' => $json]);
System::jsonExit($json);
}
function item_content(App $a)
{
if (!Session::isAuthenticated()) {
if (!DI::userSession()->isAuthenticated()) {
throw new HTTPException\UnauthorizedException();
}
@ -801,9 +799,9 @@ function item_content(App $a)
switch ($args->get(1)) {
case 'drop':
if (DI::mode()->isAjax()) {
Item::deleteForUser(['id' => $args->get(2)], local_user());
Item::deleteForUser(['id' => $args->get(2)], DI::userSession()->getLocalUserId());
// ajax return: [<item id>, 0 (no perm) | <owner id>]
System::jsonExit([intval($args->get(2)), local_user()]);
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);
} else {
if (!empty($args->get(3))) {
$o = drop_item($args->get(2), $args->get(3));
@ -812,17 +810,18 @@ function item_content(App $a)
}
}
break;
case 'block':
$item = Post::selectFirstForUser(local_user(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
if (empty($item['author-id'])) {
throw new HTTPException\NotFoundException('Item not found');
}
Contact\User::setBlocked($item['author-id'], local_user(), true);
Contact\User::setBlocked($item['author-id'], DI::userSession()->getLocalUserId(), true);
if (DI::mode()->isAjax()) {
// ajax return: [<item id>, 0 (no perm) | <owner id>]
System::jsonExit([intval($args->get(2)), local_user()]);
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);
} else {
item_redirect_after_action($item, $args->get(3));
}
@ -838,15 +837,15 @@ function item_content(App $a)
* @return string
* @throws HTTPException\InternalServerErrorException
*/
function drop_item(int $id, string $return = '')
function drop_item(int $id, string $return = ''): string
{
// locate item to be deleted
$fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'];
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $id]);
// Locate item to be deleted
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'], ['id' => $id]);
if (!DBA::isResult($item)) {
notice(DI::l10n()->t('Item not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
DI::baseUrl()->redirect('network');
//NOTREACHED
}
if ($item['deleted']) {
@ -856,18 +855,19 @@ function drop_item(int $id, string $return = '')
$contact_id = 0;
// check if logged in user is either the author or owner of this item
if (Session::getRemoteContactID($item['uid']) == $item['contact-id']) {
if (DI::userSession()->getRemoteContactID($item['uid']) == $item['contact-id']) {
$contact_id = $item['contact-id'];
}
if ((local_user() == $item['uid']) || $contact_id) {
if ((DI::userSession()->getLocalUserId() == $item['uid']) || $contact_id) {
// delete the item
Item::deleteForUser(['id' => $item['id']], local_user());
Item::deleteForUser(['id' => $item['id']], DI::userSession()->getLocalUserId());
item_redirect_after_action($item, $return);
//NOTREACHED
} else {
Logger::notice('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]);
notice(DI::l10n()->t('Permission denied.'));
Logger::warning('Permission denied.', ['local' => DI::userSession()->getLocalUserId(), 'uid' => $item['uid'], 'cid' => $contact_id]);
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('display/' . $item['guid']);
//NOTREACHED
}
@ -875,17 +875,17 @@ function drop_item(int $id, string $return = '')
return '';
}
function item_redirect_after_action($item, $returnUrlHex)
function item_redirect_after_action(array $item, string $returnUrlHex)
{
$return_url = hex2bin($returnUrlHex);
// removes update_* from return_url to ignore Ajax refresh
$return_url = str_replace("update_", "", $return_url);
$return_url = str_replace('update_', '', $return_url);
// Check if delete a comment
if ($item['gravity'] == GRAVITY_COMMENT) {
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
if (!empty($item['parent'])) {
$parentitem = Post::selectFirstForUser(local_user(), ['guid'], ['id' => $item['parent']]);
$parentitem = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid'], ['id' => $item['parent']]);
}
// Return to parent guid

View File

@ -37,7 +37,7 @@ function lostpass_post(App $a)
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('No valid account found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No valid account found.'));
DI::baseUrl()->redirect();
}
@ -49,7 +49,7 @@ function lostpass_post(App $a)
];
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
info(DI::l10n()->t('Password reset request issued. Check your email.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Password reset request issued. Check your email.'));
}
$sitename = DI::config()->get('config', 'sitename');
@ -97,7 +97,7 @@ function lostpass_content(App $a)
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
DI::sysmsg()->addNotice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
return lostpass_form();
}
@ -110,7 +110,7 @@ function lostpass_content(App $a)
];
DBA::update('user', $fields, ['uid' => $user['uid']]);
notice(DI::l10n()->t('Request has expired, please make a new one.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Request has expired, please make a new one.'));
return lostpass_form();
}
@ -152,7 +152,7 @@ function lostpass_generate_password($user)
'$newpass' => $new_password,
]);
info(DI::l10n()->t("Your password has been reset."));
DI::sysmsg()->addInfo(DI::l10n()->t("Your password has been reset."));
$sitename = DI::config()->get('config', 'sitename');
$preamble = Strings::deindent(DI::l10n()->t('

View File

@ -44,7 +44,7 @@ use Friendica\Module\Contact as ModuleContact;
*/
function match_content(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
return '';
}
@ -53,13 +53,13 @@ function match_content(App $a)
$_SESSION['return_path'] = DI::args()->getCommand();
$profile = Profile::getByUID(local_user());
$profile = Profile::getByUID(DI::userSession()->getLocalUserId());
if (!DBA::isResult($profile)) {
return '';
}
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
return '';
}
@ -67,10 +67,10 @@ function match_content(App $a)
$tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']);
if (DI::mode()->isMobile()) {
$limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
$limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
} else {
$limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
$limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
}
@ -90,7 +90,7 @@ function match_content(App $a)
}
if (empty($entries)) {
info(DI::l10n()->t('No matches'));
DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
}
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
@ -114,12 +114,12 @@ function match_get_contacts($msearch, $entries, $limit)
}
// Already known contact
$contact = Contact::getByURL($profile->url, null, ['rel'], local_user());
$contact = Contact::getByURL($profile->url, null, ['rel'], DI::userSession()->getLocalUserId());
if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
continue;
}
$contact = Contact::getByURLForUser($profile->url, local_user());
$contact = Contact::getByURLForUser($profile->url, DI::userSession()->getLocalUserId());
if (!empty($contact)) {
$entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact);
}

View File

@ -39,34 +39,34 @@ function message_init(App $a)
$tabs = '';
if (DI::args()->getArgc() > 1 && is_numeric(DI::args()->getArgv()[1])) {
$tabs = render_messages(get_messages(local_user(), 0, 5), 'mail_list.tpl');
$tabs = render_messages(get_messages(DI::userSession()->getLocalUserId(), 0, 5), 'mail_list.tpl');
}
$new = [
'label' => DI::l10n()->t('New Message'),
'url' => 'message/new',
'sel' => DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new',
'label' => DI::l10n()->t('New Message'),
'url' => 'message/new',
'sel' => DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new',
'accesskey' => 'm',
];
$tpl = Renderer::getMarkupTemplate('message_side.tpl');
DI::page()['aside'] = Renderer::replaceMacros($tpl, [
'$tabs' => $tabs,
'$new' => $new,
'$new' => $new,
]);
$base = DI::baseUrl();
$head_tpl = Renderer::getMarkupTemplate('message-head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [
'$baseurl' => DI::baseUrl()->get(true),
'$base' => $base
'$base' => $base
]);
}
function message_post(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -80,17 +80,20 @@ function message_post(App $a)
switch ($ret) {
case -1:
notice(DI::l10n()->t('No recipient selected.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
$norecip = true;
break;
case -2:
notice(DI::l10n()->t('Unable to locate contact information.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate contact information.'));
break;
case -3:
notice(DI::l10n()->t('Message could not be sent.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
break;
case -4:
notice(DI::l10n()->t('Message collection failure.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
break;
}
@ -107,8 +110,8 @@ function message_content(App $a)
$o = '';
Nav::setSelected('messages');
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form();
}
@ -118,20 +121,20 @@ function message_content(App $a)
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') {
$button = [
'label' => DI::l10n()->t('Discard'),
'url' => '/message',
'sel' => 'close',
'url' => '/message',
'sel' => 'close',
];
} else {
$button = [
'label' => DI::l10n()->t('New Message'),
'url' => '/message/new',
'sel' => 'new',
'label' => DI::l10n()->t('New Message'),
'url' => '/message/new',
'sel' => 'new',
'accesskey' => 'm',
];
}
$header = Renderer::replaceMacros($tpl, [
'$messages' => DI::l10n()->t('Messages'),
'$button' => $button,
'$button' => $button,
]);
if ((DI::args()->getArgc() == 3) && (DI::args()->getArgv()[1] === 'drop' || DI::args()->getArgv()[1] === 'dropconv')) {
@ -141,29 +144,29 @@ function message_content(App $a)
$cmd = DI::args()->getArgv()[1];
if ($cmd === 'drop') {
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
if(!DBA::isResult($message)){
notice(DI::l10n()->t('Conversation not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation not found.'));
DI::baseUrl()->redirect('message');
}
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => local_user()])) {
notice(DI::l10n()->t('Message was not deleted.'));
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()])) {
DI::sysmsg()->addNotice(DI::l10n()->t('Message was not deleted.'));
}
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => DI::userSession()->getLocalUserId()]);
if(!DBA::isResult($conversation)){
DI::baseUrl()->redirect('message');
}
DI::baseUrl()->redirect('message/' . $conversation['id'] );
} else {
$parentmail = DBA::selectFirst('mail', ['parent-uri'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
$parentmail = DBA::selectFirst('mail', ['parent-uri'], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
if (DBA::isResult($parentmail)) {
$parent = $parentmail['parent-uri'];
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
notice(DI::l10n()->t('Conversation was not removed.'));
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => DI::userSession()->getLocalUserId()])) {
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation was not removed.'));
}
}
DI::baseUrl()->redirect('message');
@ -186,19 +189,19 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('prv_message.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$header' => DI::l10n()->t('Send Private Message'),
'$to' => DI::l10n()->t('To:'),
'$subject' => DI::l10n()->t('Subject:'),
'$subjtxt' => $_REQUEST['subject'] ?? '',
'$text' => $_REQUEST['body'] ?? '',
'$readonly' => '',
'$yourmessage'=> DI::l10n()->t('Your message:'),
'$select' => $select,
'$parent' => '',
'$upload' => DI::l10n()->t('Upload photo'),
'$insert' => DI::l10n()->t('Insert web link'),
'$wait' => DI::l10n()->t('Please wait'),
'$submit' => DI::l10n()->t('Submit')
'$header' => DI::l10n()->t('Send Private Message'),
'$to' => DI::l10n()->t('To:'),
'$subject' => DI::l10n()->t('Subject:'),
'$subjtxt' => $_REQUEST['subject'] ?? '',
'$text' => $_REQUEST['body'] ?? '',
'$readonly' => '',
'$yourmessage' => DI::l10n()->t('Your message:'),
'$select' => $select,
'$parent' => '',
'$upload' => DI::l10n()->t('Upload photo'),
'$insert' => DI::l10n()->t('Insert web link'),
'$wait' => DI::l10n()->t('Please wait'),
'$submit' => DI::l10n()->t('Submit')
]);
return $o;
}
@ -212,14 +215,14 @@ function message_content(App $a)
$o .= $header;
$total = DBA::count('mail', ['uid' => local_user()], ['distinct' => true, 'expression' => 'parent-uri']);
$total = DBA::count('mail', ['uid' => DI::userSession()->getLocalUserId()], ['distinct' => true, 'expression' => 'parent-uri']);
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
$r = get_messages(DI::userSession()->getLocalUserId(), $pager->getStart(), $pager->getItemsPerPage());
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('No messages.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No messages.'));
return $o;
}
@ -240,14 +243,14 @@ function message_content(App $a)
LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = ? AND `mail`.`id` = ?
LIMIT 1",
local_user(),
DI::userSession()->getLocalUserId(),
DI::args()->getArgv()[1]
);
if (DBA::isResult($message)) {
$contact_id = $message['contact-id'];
$params = [
local_user(),
DI::userSession()->getLocalUserId(),
$message['parent-uri']
];
@ -269,13 +272,13 @@ function message_content(App $a)
$messages = DBA::toArray($messages_stmt);
DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => local_user()]);
DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => DI::userSession()->getLocalUserId()]);
} else {
$messages = false;
}
if (!DBA::isResult($messages)) {
notice(DI::l10n()->t('Message not available.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Message not available.'));
return $o;
}
@ -312,18 +315,18 @@ function message_content(App $a)
$from_photo = Contact::getThumb($contact);
$mails[] = [
'id' => $message['id'],
'from_name' => $from_name_e,
'from_url' => $from_url,
'from_addr' => $contact['addr'] ?? $from_url,
'sparkle' => $sparkle,
'id' => $message['id'],
'from_name' => $from_name_e,
'from_url' => $from_url,
'from_addr' => $contact['addr'] ?? $from_url,
'sparkle' => $sparkle,
'from_photo' => $from_photo,
'subject' => $subject_e,
'body' => $body_e,
'delete' => DI::l10n()->t('Delete message'),
'to_name' => $to_name_e,
'date' => DateTimeFormat::local($message['created'], DI::l10n()->t('D, d M Y - g:i A')),
'ago' => Temporal::getRelativeDate($message['created']),
'subject' => $subject_e,
'body' => $body_e,
'delete' => DI::l10n()->t('Delete message'),
'to_name' => $to_name_e,
'date' => DateTimeFormat::local($message['created'], DI::l10n()->t('D, d M Y - g:i A')),
'ago' => Temporal::getRelativeDate($message['created']),
];
$seen = $message['seen'];
@ -334,28 +337,27 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('mail_display.tpl');
$o = Renderer::replaceMacros($tpl, [
'$thread_id' => DI::args()->getArgv()[1],
'$thread_id' => DI::args()->getArgv()[1],
'$thread_subject' => $message['title'],
'$thread_seen' => $seen,
'$delete' => DI::l10n()->t('Delete conversation'),
'$canreply' => (($unknown) ? false : '1'),
'$unknown_text' => DI::l10n()->t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
'$mails' => $mails,
'$thread_seen' => $seen,
'$delete' => DI::l10n()->t('Delete conversation'),
'$canreply' => (($unknown) ? false : '1'),
'$unknown_text' => DI::l10n()->t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
'$mails' => $mails,
// reply
'$header' => DI::l10n()->t('Send Reply'),
'$to' => DI::l10n()->t('To:'),
'$subject' => DI::l10n()->t('Subject:'),
'$subjtxt' => $message['title'],
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',
'$yourmessage' => DI::l10n()->t('Your message:'),
'$text' => '',
'$select' => $select,
'$parent' => $parent,
'$upload' => DI::l10n()->t('Upload photo'),
'$insert' => DI::l10n()->t('Insert web link'),
'$submit' => DI::l10n()->t('Submit'),
'$wait' => DI::l10n()->t('Please wait')
'$header' => DI::l10n()->t('Send Reply'),
'$to' => DI::l10n()->t('To:'),
'$subject' => DI::l10n()->t('Subject:'),
'$subjtxt' => $message['title'],
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',
'$yourmessage' => DI::l10n()->t('Your message:'),
'$text' => '',
'$select' => $select,
'$parent' => $parent,
'$upload' => DI::l10n()->t('Upload photo'),
'$insert' => DI::l10n()->t('Insert web link'),
'$submit' => DI::l10n()->t('Submit'),
'$wait' => DI::l10n()->t('Please wait')
]);
return $o;
@ -368,7 +370,7 @@ function message_content(App $a)
* @param int $limit
* @return array
*/
function get_messages(int $uid, int $start, int $limit)
function get_messages(int $uid, int $start, int $limit): array
{
return DBA::toArray(DBA::p('SELECT
m.`id`,
@ -392,21 +394,21 @@ function get_messages(int $uid, int $start, int $limit)
c.`url`,
c.`thumb`,
c.`network`,
m2.`count`,
m2.`mailcreated`,
m2.`mailseen`
FROM `mail` m
JOIN (
SELECT
`parent-uri`,
MIN(`id`) AS `id`,
COUNT(*) AS `count`,
MAX(`created`) AS `mailcreated`,
MIN(`seen`) AS `mailseen`
FROM `mail`
WHERE `uid` = ?
GROUP BY `parent-uri`
) m2 ON m.`parent-uri` = m2.`parent-uri` AND m.`id` = m2.`id`
m2.`count`,
m2.`mailcreated`,
m2.`mailseen`
FROM `mail` m
JOIN (
SELECT
`parent-uri`,
MIN(`id`) AS `id`,
COUNT(*) AS `count`,
MAX(`created`) AS `mailcreated`,
MIN(`seen`) AS `mailseen`
FROM `mail`
WHERE `uid` = ?
GROUP BY `parent-uri`
) m2 ON m.`parent-uri` = m2.`parent-uri` AND m.`id` = m2.`id`
LEFT JOIN `contact` c ON m.`contact-id` = c.`id`
WHERE m.`uid` = ?
ORDER BY m2.`mailcreated` DESC
@ -414,7 +416,7 @@ function get_messages(int $uid, int $start, int $limit)
, $uid, $uid, $start, $limit));
}
function render_messages(array $msg, $t)
function render_messages(array $msg, string $t): string
{
$a = DI::app();
@ -444,20 +446,20 @@ function render_messages(array $msg, $t)
$from_photo = Contact::getThumb($contact);
$rslt .= Renderer::replaceMacros($tpl, [
'$id' => $rr['id'],
'$from_name' => $participants,
'$from_url' => Contact::magicLink($rr['url']),
'$from_addr' => $contact['addr'] ?? '',
'$sparkle' => ' sparkle',
'$id' => $rr['id'],
'$from_name' => $participants,
'$from_url' => Contact::magicLink($rr['url']),
'$from_addr' => $contact['addr'] ?? '',
'$sparkle' => ' sparkle',
'$from_photo' => $from_photo,
'$subject' => $rr['title'],
'$delete' => DI::l10n()->t('Delete conversation'),
'$body' => $body_e,
'$to_name' => $to_name_e,
'$date' => DateTimeFormat::local($rr['mailcreated'], DI::l10n()->t('D, d M Y - g:i A')),
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
'$seen' => $rr['mailseen'],
'$count' => DI::l10n()->tt('%d message', '%d messages', $rr['count']),
'$subject' => $rr['title'],
'$delete' => DI::l10n()->t('Delete conversation'),
'$body' => $body_e,
'$to_name' => $to_name_e,
'$date' => DateTimeFormat::local($rr['mailcreated'], DI::l10n()->t('D, d M Y - g:i A')),
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
'$seen' => $rr['mailseen'],
'$count' => DI::l10n()->tt('%d message', '%d messages', $rr['count']),
]);
}

View File

@ -30,7 +30,7 @@ use Friendica\Module\BaseProfile;
function notes_init(App $a)
{
if (! local_user()) {
if (! DI::userSession()->getLocalUserId()) {
return;
}
@ -38,10 +38,10 @@ function notes_init(App $a)
}
function notes_content(App $a, $update = false)
function notes_content(App $a, bool $update = false)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -52,7 +52,7 @@ function notes_content(App $a, $update = false)
$x = [
'lockstate' => 'lock',
'acl' => \Friendica\Core\ACL::getSelfOnlyHTML(local_user(), DI::l10n()->t('Personal notes are visible only by yourself.')),
'acl' => \Friendica\Core\ACL::getSelfOnlyHTML(DI::userSession()->getLocalUserId(), DI::l10n()->t('Personal notes are visible only by yourself.')),
'button' => DI::l10n()->t('Save'),
'acl_data' => '',
];
@ -60,14 +60,14 @@ function notes_content(App $a, $update = false)
$o .= DI::conversation()->statusEditor($x, $a->getContactId());
}
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
$condition = ['uid' => DI::userSession()->getLocalUserId(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => Item::GRAVITY_PARENT,
'contact-id'=> $a->getContactId()];
if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
} else {
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
}
@ -75,7 +75,7 @@ function notes_content(App $a, $update = false)
$params = ['order' => ['created' => true],
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
$r = Post::selectThreadForUser(local_user(), ['uri-id'], $condition, $params);
$r = Post::selectThreadForUser(DI::userSession()->getLocalUserId(), ['uri-id'], $condition, $params);
$count = 0;

View File

@ -20,25 +20,84 @@
*/
use Friendica\App;
use Friendica\Core\Renderer;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Module\Response;
use Friendica\Module\Security\Login;
use Friendica\Util\XML;
function oexchange_init(App $a) {
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'xrd')) {
$tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
$o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
System::httpExit($o, Response::TYPE_XML, 'application/xrd+xml');
function oexchange_init(App $a)
{
if ((DI::args()->getArgc() <= 1) || (DI::args()->getArgv()[1] != 'xrd')) {
return;
}
$baseURL = DI::baseUrl()->get();
$xml = null;
XML::fromArray([
'XRD' => [
'@attributes' => [
'xmlns' => 'http://docs.oasis-open.org/ns/xri/xrd-1.0',
],
'Subject' => $baseURL,
'1:Property' => [
'@attributes' => [
'type' => 'http://www.oexchange.org/spec/0.8/prop/vendor',
],
'Friendica'
],
'2:Property' => [
'@attributes' => [
'type' => 'http://www.oexchange.org/spec/0.8/prop/title',
],
'Friendica Social Network'
],
'3:Property' => [
'@attributes' => [
'type' => 'http://www.oexchange.org/spec/0.8/prop/name',
],
'Friendica'
],
'4:Property' => [
'@attributes' => [
'type' => 'http://www.oexchange.org/spec/0.8/prop/prompt',
],
'Send to Friendica'
],
'1:link' => [
'@attributes' => [
'rel' => 'icon',
'type' => 'image/png',
'href' => $baseURL . '/images/friendica-16.png'
]
],
'2:link' => [
'@attributes' => [
'rel' => 'icon32',
'type' => 'image/png',
'href' => $baseURL . '/images/friendica-32.png'
]
],
'3:link' => [
'@attributes' => [
'rel' => 'http://www.oexchange.org/spec/0.8/rel/offer',
'type' => 'text/html',
'href' => $baseURL . '/oexchange'
]
],
],
], $xml);
System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/xrd+xml');
}
function oexchange_content(App $a) {
if (!local_user()) {
function oexchange_content(App $a)
{
if (!DI::userSession()->getLocalUserId()) {
$o = Login::form();
return $o;
}
@ -52,7 +111,7 @@ function oexchange_content(App $a) {
$description = !empty($_REQUEST['description']) ? trim($_REQUEST['description']) : '';
$tags = !empty($_REQUEST['tags']) ? trim($_REQUEST['tags']) : '';
$s = \Friendica\Content\Text\BBCode::embedURL($url, true, $title, $description, $tags);
$s = BBCode::embedURL($url, true, $title, $description, $tags);
if (!strlen($s)) {
return;
@ -60,11 +119,11 @@ function oexchange_content(App $a) {
$post = [];
$post['profile_uid'] = local_user();
$post['profile_uid'] = DI::userSession()->getLocalUserId();
$post['return'] = '/oexchange/done';
$post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
$post['body'] = HTML::toBBCode($s);
$_REQUEST = $post;
require_once('mod/item.php');
require_once 'mod/item.php';
item_post($a);
}

View File

@ -27,22 +27,21 @@ use Friendica\Model\Contact;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Protocol\ActivityPub;
function ostatus_subscribe_content(App $a)
function ostatus_subscribe_content(App $a): string
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('ostatus_subscribe');
// NOTREACHED
}
$o = '<h2>' . DI::l10n()->t('Subscribing to contacts') . '</h2>';
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$counter = intval($_REQUEST['counter'] ?? 0);
if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') {
if ($_REQUEST['url'] == '') {
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
return $o . DI::l10n()->t('No contact provided.');

View File

@ -30,7 +30,6 @@ use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -55,9 +54,9 @@ use Friendica\Util\Temporal;
use Friendica\Util\XML;
use Friendica\Network\HTTPException;
function photos_init(App $a) {
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
function photos_init(App $a)
{
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
return;
}
@ -69,11 +68,11 @@ function photos_init(App $a) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$is_owner = (local_user() && (local_user() == $owner['uid']));
$is_owner = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner['uid']));
$albums = Photo::getAlbums($owner['uid']);
$albums_visible = ((intval($owner['hidewall']) && !Session::isAuthenticated()) ? false : true);
$albums_visible = ((intval($owner['hidewall']) && !DI::userSession()->isAuthenticated()) ? false : true);
// add various encodings to the array so we can just loop through and pick them out in a template
$ret = ['success' => false];
@ -96,7 +95,7 @@ function photos_init(App $a) {
}
}
if (local_user() && $owner['uid'] == local_user()) {
if (DI::userSession()->getLocalUserId() && $owner['uid'] == DI::userSession()->getLocalUserId()) {
$can_post = true;
} else {
$can_post = false;
@ -148,23 +147,23 @@ function photos_post(App $a)
$page_owner_uid = intval($user['uid']);
$community_page = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
if (local_user() && (local_user() == $page_owner_uid)) {
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
$contact_id = Session::getRemoteContactID($page_owner_uid);
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = true;
$visitor = $contact_id;
}
if (!$can_post) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
System::exit();
}
$owner_record = User::getOwnerDataById($page_owner_uid);
if (!$owner_record) {
notice(DI::l10n()->t('Contact information unavailable'));
DI::sysmsg()->addNotice(DI::l10n()->t('Contact information unavailable'));
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
System::exit();
}
@ -193,7 +192,7 @@ function photos_post(App $a)
$album = hex2bin(DI::args()->getArgv()[3]);
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
notice(DI::l10n()->t('Album not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album not found.'));
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
return; // NOTREACHED
}
@ -229,7 +228,7 @@ function photos_post(App $a)
));
} else {
$r = DBA::toArray(DBA::p("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = ? AND `album` = ?",
local_user(),
DI::userSession()->getLocalUserId(),
$album
));
}
@ -247,9 +246,9 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
notice(DI::l10n()->t('Album successfully deleted'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
} else {
notice(DI::l10n()->t('Album was empty.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album was empty.'));
}
}
@ -268,7 +267,7 @@ function photos_post(App $a)
$condition = ['contact-id' => $visitor, 'uid' => $page_owner_uid, 'resource-id' => DI::args()->getArgv()[3]];
} else {
$condition = ['uid' => local_user(), 'resource-id' => DI::args()->getArgv()[3]];
$condition = ['uid' => DI::userSession()->getLocalUserId(), 'resource-id' => DI::args()->getArgv()[3]];
}
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
@ -281,7 +280,7 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
} else {
notice(DI::l10n()->t('Failed to delete the photo.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to delete the photo.'));
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
}
@ -304,7 +303,7 @@ function photos_post(App $a)
}
if (!empty($_POST['rotate']) && (intval($_POST['rotate']) == 1 || intval($_POST['rotate']) == 2)) {
Logger::notice('rotate');
Logger::debug('rotate');
$photo = Photo::getPhotoForUser($page_owner_uid, $resource_id);
@ -526,44 +525,40 @@ function photos_post(App $a)
foreach ($taginfo as $tagged) {
$uri = Item::newURI();
$arr = [];
$arr['guid'] = System::createUUID();
$arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri;
$arr['wall'] = 1;
$arr['contact-id'] = $owner_record['id'];
$arr['owner-name'] = $owner_record['name'];
$arr['owner-link'] = $owner_record['url'];
$arr['owner-avatar'] = $owner_record['thumb'];
$arr['author-name'] = $owner_record['name'];
$arr['author-link'] = $owner_record['url'];
$arr['author-avatar'] = $owner_record['thumb'];
$arr['title'] = '';
$arr['allow_cid'] = $photo['allow_cid'];
$arr['allow_gid'] = $photo['allow_gid'];
$arr['deny_cid'] = $photo['deny_cid'];
$arr['deny_gid'] = $photo['deny_gid'];
$arr['visible'] = 0;
$arr['verb'] = Activity::TAG;
$arr['gravity'] = GRAVITY_PARENT;
$arr['object-type'] = Activity\ObjectType::PERSON;
$arr['target-type'] = Activity\ObjectType::IMAGE;
$arr['inform'] = $tagged[2];
$arr['origin'] = 1;
$arr['body'] = DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
$arr['body'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
$arr = [
'guid' => System::createUUID(),
'uid' => $page_owner_uid,
'uri' => $uri,
'wall' => 1,
'contact-id' => $owner_record['id'],
'owner-name' => $owner_record['name'],
'owner-link' => $owner_record['url'],
'owner-avatar' => $owner_record['thumb'],
'author-name' => $owner_record['name'],
'author-link' => $owner_record['url'],
'author-avatar' => $owner_record['thumb'],
'title' => '',
'allow_cid' => $photo['allow_cid'],
'allow_gid' => $photo['allow_gid'],
'deny_cid' => $photo['deny_cid'],
'deny_gid' => $photo['deny_gid'],
'visible' => 0,
'verb' => Activity::TAG,
'gravity' => Item::GRAVITY_PARENT,
'object-type' => Activity\ObjectType::PERSON,
'target-type' => Activity\ObjectType::IMAGE,
'inform' => $tagged[2],
'origin' => 1,
'body' => DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') . "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n",
'object' => '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"),
'target' => '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>',
];
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
if ($tagged[3]) {
$arr['object'] .= XML::escape('<link rel="photo" type="' . $photo['type'] . '" href="' . $tagged[3]['photo'] . '" />' . "\n");
}
$arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
. DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
Item::insert($arr);
}
}
@ -580,7 +575,7 @@ function photos_post(App $a)
$album = trim($_REQUEST['album'] ?? '');
$newalbum = trim($_REQUEST['newalbum'] ?? '');
Logger::info('album= ' . $album . ' newalbum= ' . $newalbum);
Logger::debug('album= ' . $album . ' newalbum= ' . $newalbum);
if (!strlen($album)) {
if (strlen($newalbum)) {
@ -633,21 +628,21 @@ function photos_post(App $a)
if ($error !== UPLOAD_ERR_OK) {
switch ($error) {
case UPLOAD_ERR_INI_SIZE:
notice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
break;
case UPLOAD_ERR_FORM_SIZE:
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
break;
case UPLOAD_ERR_PARTIAL:
notice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
break;
case UPLOAD_ERR_NO_FILE:
notice(DI::l10n()->t('Image file is missing'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is missing'));
break;
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
notice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
DI::sysmsg()->addNotice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
break;
}
@unlink($src);
@ -663,7 +658,7 @@ function photos_post(App $a)
$maximagesize = DI::config()->get('system', 'maximagesize');
if ($maximagesize && ($filesize > $maximagesize)) {
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
@ -671,22 +666,22 @@ function photos_post(App $a)
}
if (!$filesize) {
notice(DI::l10n()->t('Image file is empty.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is empty.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
return;
}
Logger::info('loading the contents of ' . $src);
Logger::debug('loading contents', ['src' => $src]);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $type);
if (!$image->isValid()) {
Logger::info('unable to process image');
notice(DI::l10n()->t('Unable to process image.'));
Logger::notice('unable to process image');
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end',$foo);
@ -711,8 +706,8 @@ function photos_post(App $a)
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0 , Photo::DEFAULT, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if (!$r) {
Logger::info('image store failed');
notice(DI::l10n()->t('Image upload failed.'));
Logger::warning('image store failed');
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
return;
}
@ -798,13 +793,13 @@ function photos_content(App $a)
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
notice(DI::l10n()->t('Public access denied.'));
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
return;
}
if (empty($user)) {
notice(DI::l10n()->t('No photos selected'));
DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
return;
}
@ -844,10 +839,10 @@ function photos_content(App $a)
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
if (local_user() && (local_user() == $owner_uid)) {
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($owner_uid))) {
$contact_id = Session::getRemoteContactID($owner_uid);
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($owner_uid);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
if (DBA::isResult($contact)) {
@ -858,22 +853,22 @@ function photos_content(App $a)
}
// perhaps they're visiting - but not a community page, so they wouldn't have write access
if (!empty(Session::getRemoteContactID($owner_uid)) && !$visitor) {
$contact_id = Session::getRemoteContactID($owner_uid);
if (!empty(DI::userSession()->getRemoteContactID($owner_uid)) && !$visitor) {
$contact_id = DI::userSession()->getRemoteContactID($owner_uid);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
$remote_contact = DBA::isResult($contact);
}
if (!$remote_contact && local_user()) {
if (!$remote_contact && DI::userSession()->getLocalUserId()) {
$contact_id = $_SESSION['cid'];
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
}
if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
notice(DI::l10n()->t('Access to this item is restricted.'));
if ($user['hidewall'] && (DI::userSession()->getLocalUserId() != $owner_uid) && !$remote_contact) {
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this item is restricted.'));
return;
}
@ -882,13 +877,13 @@ function photos_content(App $a)
$o = "";
// tabs
$is_owner = (local_user() && (local_user() == $owner_uid));
$is_owner = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner_uid));
$o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $user['nickname'], $profile['hide-friends']);
// Display upload form
if ($datatype === 'upload') {
if (!$can_post) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -1088,9 +1083,9 @@ function photos_content(App $a)
if (!DBA::isResult($ph)) {
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
notice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
} else {
notice(DI::l10n()->t('Photo not available'));
DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
}
return;
}
@ -1201,7 +1196,7 @@ function photos_content(App $a)
}
if (
$ph[0]['uid'] == local_user()
$ph[0]['uid'] == DI::userSession()->getLocalUserId()
&& (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid']))
) {
$tools['lock'] = DI::l10n()->t('Private Photo');
@ -1233,7 +1228,7 @@ function photos_content(App $a)
$link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], GRAVITY_COMMENT];
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], Item::GRAVITY_COMMENT];
$total = Post::count($condition);
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
@ -1241,7 +1236,7 @@ function photos_content(App $a)
$params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
$items = Post::toArray(Post::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params));
if (local_user() == $link_item['uid']) {
if (DI::userSession()->getLocalUserId() == $link_item['uid']) {
Item::update(['unseen' => false], ['parent' => $link_item['parent']]);
}
}
@ -1319,7 +1314,7 @@ function photos_content(App $a)
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
@ -1350,7 +1345,7 @@ function photos_content(App $a)
'attendmaybe' => []
];
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike')) {
unset($conv_responses['dislike']);
}
@ -1375,7 +1370,7 @@ function photos_content(App $a)
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
@ -1404,7 +1399,7 @@ function photos_content(App $a)
if (($activity->match($item['verb'], Activity::LIKE) ||
$activity->match($item['verb'], Activity::DISLIKE)) &&
($item['gravity'] != GRAVITY_PARENT)) {
($item['gravity'] != Item::GRAVITY_PARENT)) {
continue;
}
@ -1417,29 +1412,29 @@ function photos_content(App $a)
$sparkle = '';
}
$dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user()));
$dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == DI::userSession()->getLocalUserId()));
$drop = [
'dropping' => $dropping,
'pagedrop' => false,
'select' => DI::l10n()->t('Select'),
'delete' => DI::l10n()->t('Delete'),
'select' => DI::l10n()->t('Select'),
'delete' => DI::l10n()->t('Delete'),
];
$title_e = $item['title'];
$body_e = BBCode::convertForUriId($item['uri-id'], $item['body']);
$comments .= Renderer::replaceMacros($template,[
'$id' => $item['id'],
'$id' => $item['id'],
'$profile_url' => $profile_url,
'$name' => $item['author-name'],
'$thumb' => $item['author-avatar'],
'$sparkle' => $sparkle,
'$title' => $title_e,
'$body' => $body_e,
'$ago' => Temporal::getRelativeDate($item['created']),
'$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''),
'$drop' => $drop,
'$comment' => $comment
'$name' => $item['author-name'],
'$thumb' => $item['author-avatar'],
'$sparkle' => $sparkle,
'$title' => $title_e,
'$body' => $body_e,
'$ago' => Temporal::getRelativeDate($item['created']),
'$indent' => (($item['parent'] != $item['id']) ? ' comment' : ''),
'$drop' => $drop,
'$comment' => $comment
]);
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
@ -1449,7 +1444,7 @@ function photos_content(App $a)
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
@ -1488,7 +1483,7 @@ function photos_content(App $a)
'$dislike' => DI::l10n()->t('Dislike'),
'$wait' => DI::l10n()->t('Please wait'),
'$dislike_title' => DI::l10n()->t('I don\'t like this (toggle)'),
'$hide_dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike'),
'$hide_dislike' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike'),
'$responses' => $responses,
'$return_path' => DI::args()->getQueryString(),
]);

View File

@ -24,13 +24,10 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Response;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\XML;
function poco_init(App $a) {
if (intval(DI::config()->get('system', 'block_public')) || (DI::config()->get('system', 'block_local_dir'))) {
@ -229,12 +226,9 @@ function poco_init(App $a) {
Logger::info("End of poco");
if ($format === 'xml') {
System::httpExit(Renderer::replaceMacros(Renderer::getMarkupTemplate('poco_xml.tpl'), XML::arrayEscape(['$response' => $ret])), Response::TYPE_XML);
}
if ($format === 'json') {
System::jsonExit($ret);
} else {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
throw new \Friendica\Network\HTTPException\UnsupportedMediaTypeException();
}
}

View File

@ -145,7 +145,7 @@ function pubsub_post(App $a)
}
// We only import feeds from OStatus here
if ($contact['network'] != Protocol::OSTATUS) {
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS])) {
Logger::warning('Unexpected network', ['contact' => $contact]);
hub_post_return();
}

View File

@ -21,7 +21,6 @@
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -32,7 +31,7 @@ use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Util\Strings;
function redir_init(App $a) {
if (!Session::isAuthenticated()) {
if (!DI::userSession()->isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
@ -52,7 +51,7 @@ function redir_init(App $a) {
}
$fields = ['id', 'uid', 'nurl', 'url', 'addr', 'name'];
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, DI::userSession()->getLocalUserId()]]);
if (!DBA::isResult($contact)) {
throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Contact not found.'));
}
@ -65,10 +64,10 @@ function redir_init(App $a) {
$a->redirect($url ?: $contact_url);
}
if ($contact['uid'] == 0 && local_user()) {
if ($contact['uid'] == 0 && DI::userSession()->getLocalUserId()) {
// Let's have a look if there is an established connection
// between the public contact we have found and the local user.
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => DI::userSession()->getLocalUserId()]);
if (DBA::isResult($contact)) {
$cid = $contact['id'];
@ -83,7 +82,7 @@ function redir_init(App $a) {
}
}
if (remote_user()) {
if (DI::userSession()->getRemoteUserId()) {
$host = substr(DI::baseUrl()->getUrlPath() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''), strpos(DI::baseUrl()->getUrlPath(), '://') + 3);
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
@ -91,7 +90,7 @@ function redir_init(App $a) {
// with the local contact. Otherwise the local user would ask the local contact
// for authentification everytime he/she is visiting a profile page of the local
// contact.
if (($host == $remotehost) && (Session::getRemoteContactID(Session::get('visitor_visiting')) == Session::get('visitor_id'))) {
if (($host == $remotehost) && (DI::userSession()->getRemoteContactID(DI::session()->get('visitor_visiting')) == DI::session()->get('visitor_id'))) {
// Remote user is already authenticated.
redir_check_url($contact_url, $url);
$target_url = $url ?: $contact_url;

View File

@ -28,11 +28,11 @@ use Friendica\Util\Strings;
function removeme_post(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
return;
}
if (!empty($_SESSION['submanage'])) {
if (DI::userSession()->getSubManagedUserId()) {
return;
}
@ -64,7 +64,7 @@ function removeme_post(App $a)
->withMessage(
$l10n->t('[Friendica System Notify]') . ' ' . $l10n->t('User deleted their account'),
$l10n->t('On your Friendica node an user deleted their account. Please ensure that their data is removed from the backups.'),
$l10n->t('The user id is %d', local_user()))
$l10n->t('The user id is %d', DI::userSession()->getLocalUserId()))
->forUser($admin)
->withRecipient($admin['email'])
->build();
@ -83,7 +83,7 @@ function removeme_post(App $a)
function removeme_content(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
DI::baseUrl()->redirect();
}

View File

@ -27,15 +27,15 @@ use Friendica\Model\Contact;
function repair_ostatus_content(App $a) {
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('ostatus_repair');
// NOTREACHED
}
$o = '<h2>' . DI::l10n()->t('Resubscribing to OStatus contacts') . '</h2>';
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$counter = intval($_REQUEST['counter'] ?? 0);
@ -43,7 +43,7 @@ function repair_ostatus_content(App $a) {
$total = DBA::count('contact', $condition);
if (!$total) {
return ($o . DI::l10n()->t('Error'));
return ($o . DI::l10n()->tt('Error', 'Errors', 1));
}
$contact = Contact::selectToArray(['url'], $condition, ['order' => ['url'], 'limit' => [$counter++, 1]]);

View File

@ -36,8 +36,8 @@ use Friendica\Protocol\Email;
function settings_init(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -47,11 +47,11 @@ function settings_init(App $a)
function settings_post(App $a)
{
if (!$a->isLoggedIn()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
if (!empty($_SESSION['submanage'])) {
if (DI::userSession()->getSubManagedUserId()) {
return;
}
@ -69,12 +69,13 @@ function settings_post(App $a)
BaseModule::checkFormSecurityTokenRedirectOnError(DI::args()->getQueryString(), 'settings_connectors');
if (!empty($_POST['general-submit'])) {
DI::pConfig()->set(local_user(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer']));
DI::pConfig()->set(local_user(), 'system', 'disable_cw', !intval($_POST['enable_cw']));
DI::pConfig()->set(local_user(), 'system', 'no_intelligent_shortening', !intval($_POST['enable_smart_shortening']));
DI::pConfig()->set(local_user(), 'system', 'simple_shortening', intval($_POST['simple_shortening']));
DI::pConfig()->set(local_user(), 'system', 'attach_link_title', intval($_POST['attach_link_title']));
DI::pConfig()->set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'disable_cw', !intval($_POST['enable_cw']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'enable_cw_self', intval($_POST['enable_cw_self']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'no_intelligent_shortening', !intval($_POST['enable_smart_shortening']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'simple_shortening', intval($_POST['simple_shortening']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'attach_link_title', intval($_POST['attach_link_title']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
} elseif (!empty($_POST['mail-submit'])) {
$mail_server = $_POST['mail_server'] ?? '';
$mail_port = $_POST['mail_port'] ?? '';
@ -87,13 +88,13 @@ function settings_post(App $a)
$mail_pubmail = $_POST['mail_pubmail'] ?? '';
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
if (!DBA::exists('mailacct', ['uid' => local_user()])) {
DBA::insert('mailacct', ['uid' => local_user()]);
if (!DBA::exists('mailacct', ['uid' => DI::userSession()->getLocalUserId()])) {
DBA::insert('mailacct', ['uid' => DI::userSession()->getLocalUserId()]);
}
if (strlen($mail_pass)) {
$pass = '';
openssl_public_encrypt($mail_pass, $pass, $user['pubkey']);
DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => DI::userSession()->getLocalUserId()]);
}
$r = DBA::update('mailacct', [
@ -106,10 +107,10 @@ function settings_post(App $a)
'mailbox' => 'INBOX',
'reply_to' => $mail_replyto,
'pubmail' => $mail_pubmail
], ['uid' => local_user()]);
], ['uid' => DI::userSession()->getLocalUserId()]);
Logger::notice('updating mailaccount', ['response' => $r]);
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => local_user()]);
Logger::debug('updating mailaccount', ['response' => $r]);
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => DI::userSession()->getLocalUserId()]);
if (DBA::isResult($mailacct)) {
$mb = Email::constructMailboxName($mailacct);
@ -119,7 +120,7 @@ function settings_post(App $a)
$mbox = Email::connect($mb, $mail_user, $dcrpass);
unset($dcrpass);
if (!$mbox) {
notice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
}
}
}
@ -135,7 +136,7 @@ function settings_post(App $a)
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/features', 'settings_features');
foreach ($_POST as $k => $v) {
if (strpos($k, 'feature_') === 0) {
DI::pConfig()->set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0));
}
}
return;
@ -147,13 +148,13 @@ function settings_content(App $a)
$o = '';
Nav::setSelected('settings');
if (!local_user()) {
//notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
//DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form();
}
if (!empty($_SESSION['submanage'])) {
notice(DI::l10n()->t('Permission denied.'));
if (DI::userSession()->getSubManagedUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return '';
}
@ -161,12 +162,12 @@ function settings_content(App $a)
if ((DI::args()->getArgc() > 3) && (DI::args()->getArgv()[2] === 'delete')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't');
DBA::delete('application-token', ['application-id' => DI::args()->getArgv()[3], 'uid' => local_user()]);
DBA::delete('application-token', ['application-id' => DI::args()->getArgv()[3], 'uid' => DI::userSession()->getLocalUserId()]);
DI::baseUrl()->redirect('settings/oauth/', true);
return '';
}
$applications = DBA::selectToArray('application-view', ['id', 'uid', 'name', 'website', 'scopes', 'created_at'], ['uid' => local_user()]);
$applications = DBA::selectToArray('application-view', ['id', 'uid', 'name', 'website', 'scopes', 'created_at'], ['uid' => DI::userSession()->getLocalUserId()]);
$tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
$o .= Renderer::replaceMacros($tpl, [
@ -225,7 +226,7 @@ function settings_content(App $a)
$arr[$fname] = [];
$arr[$fname][0] = $fdata[0];
foreach (array_slice($fdata,1) as $f) {
$arr[$fname][1][] = ['feature_' . $f[0], $f[1], Feature::isEnabled(local_user(), $f[0]), $f[2]];
$arr[$fname][1][] = ['feature_' . $f[0], $f[1], Feature::isEnabled(DI::userSession()->getLocalUserId(), $f[0]), $f[2]];
}
}
@ -240,12 +241,13 @@ function settings_content(App $a)
}
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors')) {
$accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer'));
$enable_cw = !intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
$enable_smart_shortening = !intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));
$simple_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'simple_shortening'));
$attach_link_title = intval(DI::pConfig()->get(local_user(), 'system', 'attach_link_title'));
$legacy_contact = DI::pConfig()->get(local_user(), 'ostatus', 'legacy_contact');
$accept_only_sharer = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'accept_only_sharer'));
$enable_cw = !intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'disable_cw'));
$enable_cw_self = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'enable_cw_self'));
$enable_smart_shortening = !intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_intelligent_shortening'));
$simple_shortening = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'simple_shortening'));
$attach_link_title = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'attach_link_title'));
$legacy_contact = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ostatus', 'legacy_contact');
if (!empty($legacy_contact)) {
/// @todo Isn't it supposed to be a $a->internalRedirect() call?
@ -279,7 +281,7 @@ function settings_content(App $a)
$mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
if (!$mail_disabled) {
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => local_user()]);
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => DI::userSession()->getLocalUserId()]);
} else {
$mailacct = null;
}
@ -326,6 +328,7 @@ function settings_content(App $a)
]
],
'$enable_cw' => ['enable_cw', DI::l10n()->t('Enable Content Warning'), $enable_cw, DI::l10n()->t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. This enables the automatic collapsing instead of setting the content warning as the post title. Doesn\'t affect any other content filtering you eventually set up.')],
'$enable_cw_self' => ['enable_cw_self', DI::l10n()->t('Show content warnings on own posts'), $enable_cw_self, DI::l10n()->t('Normally Friendica only displays content warnings on posts created by other users. If this option is enabled it will also display content warnings on your own posts.')],
'$enable_smart_shortening' => ['enable_smart_shortening', DI::l10n()->t('Enable intelligent shortening'), $enable_smart_shortening, DI::l10n()->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')],
'$simple_shortening' => ['simple_shortening', DI::l10n()->t('Enable simple text shortening'), $simple_shortening, DI::l10n()->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')],
'$attach_link_title' => ['attach_link_title', DI::l10n()->t('Attach the link title'), $attach_link_title, DI::l10n()->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')],

View File

@ -30,32 +30,22 @@ use Friendica\Model\Post;
function share_init(App $a) {
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id || !local_user()) {
if (!$post_id || !DI::userSession()->getLocalUserId()) {
System::exit();
}
$fields = ['private', 'body', 'author-name', 'author-link', 'author-avatar',
'guid', 'created', 'plink', 'title'];
$fields = ['private', 'body', 'uri'];
$item = Post::selectFirst($fields, ['id' => $post_id]);
if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) {
System::exit();
}
if (strpos($item['body'], "[/share]") !== false) {
$pos = strpos($item['body'], "[share");
$o = substr($item['body'], $pos);
$shared = DI::contentItem()->getSharedPost($item, ['uri']);
if (!empty($shared) && empty($shared['comment'])) {
$content = '[share]' . $shared['post']['uri'] . '[/share]';
} else {
$o = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid']);
if ($item['title']) {
$o .= '[h3]'.$item['title'].'[/h3]'."\n";
}
$o .= $item['body'];
$o .= "[/share]";
$content = '[share]' . $item['uri'] . '[/share]';
}
echo $o;
System::exit();
System::httpExit($content);
}

View File

@ -30,7 +30,7 @@ use Friendica\Network\HTTPException;
function suggest_content(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
@ -39,7 +39,7 @@ function suggest_content(App $a)
DI::page()['aside'] .= Widget::findPeople();
DI::page()['aside'] .= Widget::follow();
$contacts = Contact\Relation::getSuggestions(local_user());
$contacts = Contact\Relation::getSuggestions(DI::userSession()->getLocalUserId());
if (!DBA::isResult($contacts)) {
return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
}

View File

@ -22,7 +22,6 @@
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -35,9 +34,9 @@ use Friendica\Protocol\Activity;
use Friendica\Util\XML;
use Friendica\Worker\Delivery;
function tagger_content(App $a) {
if (!Session::isAuthenticated()) {
function tagger_content(App $a)
{
if (!DI::userSession()->isAuthenticated()) {
return;
}
@ -51,7 +50,7 @@ function tagger_content(App $a) {
$item_id = ((DI::args()->getArgc() > 1) ? trim(DI::args()->getArgv()[1]) : 0);
Logger::notice('tagger: tag ' . $term . ' item ' . $item_id);
Logger::info('tagger: tag', ['term' => $term, 'item' => $item_id]);
$item = Post::selectFirst([], ['id' => $item_id]);
@ -63,13 +62,13 @@ function tagger_content(App $a) {
$owner_uid = $item['uid'];
if (local_user() != $owner_uid) {
if (DI::userSession()->getLocalUserId() != $owner_uid) {
return;
}
$contact = Contact::selectFirst([], ['self' => true, 'uid' => local_user()]);
$contact = Contact::selectFirst([], ['self' => true, 'uid' => DI::userSession()->getLocalUserId()]);
if (!DBA::isResult($contact)) {
Logger::notice('tagger: no contact_id');
Logger::warning('Self contact not found.', ['uid' => DI::userSession()->getLocalUserId()]);
return;
}
@ -116,41 +115,41 @@ EOT;
$termlink = html_entity_decode('&#x2317;') . '[url=' . DI::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
$arr = [];
$arr['guid'] = System::createUUID();
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
$arr['wall'] = $item['wall'];
$arr['gravity'] = GRAVITY_COMMENT;
$arr['parent'] = $item['id'];
$arr['thr-parent'] = $item['uri'];
$arr['owner-name'] = $item['author-name'];
$arr['owner-link'] = $item['author-link'];
$arr['owner-avatar'] = $item['author-avatar'];
$arr['author-name'] = $contact['name'];
$arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink );
$arr['verb'] = Activity::TAG;
$arr['target-type'] = $targettype;
$arr['target'] = $target;
$arr['object-type'] = $objtype;
$arr['object'] = $obj;
$arr['private'] = $item['private'];
$arr['allow_cid'] = $item['allow_cid'];
$arr['allow_gid'] = $item['allow_gid'];
$arr['deny_cid'] = $item['deny_cid'];
$arr['deny_gid'] = $item['deny_gid'];
$arr['visible'] = 1;
$arr['unseen'] = 1;
$arr['origin'] = 1;
$arr = [
'guid' => System::createUUID(),
'uri' => $uri,
'uid' => $owner_uid,
'contact-id' => $contact['id'],
'wall' => $item['wall'],
'gravity' => Item::GRAVITY_COMMENT,
'parent' => $item['id'],
'thr-parent' => $item['uri'],
'owner-name' => $item['author-name'],
'owner-link' => $item['author-link'],
'owner-avatar' => $item['author-avatar'],
'author-name' => $contact['name'],
'author-link' => $contact['url'],
'author-avatar' => $contact['thumb'],
'body' => sprintf($bodyverb, $ulink, $alink, $plink, $termlink),
'verb' => Activity::TAG,
'target-type' => $targettype,
'target' => $target,
'object-type' => $objtype,
'object' => $obj,
'private' => $item['private'],
'allow_cid' => $item['allow_cid'],
'allow_gid' => $item['allow_gid'],
'deny_cid' => $item['deny_cid'],
'deny_gid' => $item['deny_gid'],
'visible' => 1,
'unseen' => 1,
'origin' => 1,
];
$post_id = Item::insert($arr);
@ -166,6 +165,6 @@ EOT;
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
System::exit();
}

View File

@ -28,7 +28,7 @@ use Friendica\Model\Tag;
function tagrm_post(App $a)
{
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
@ -61,7 +61,7 @@ function update_tags($item_id, $tags)
return;
}
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => DI::userSession()->getLocalUserId()]);
if (!DBA::isResult($item)) {
return;
}
@ -81,7 +81,7 @@ function tagrm_content(App $a)
$photo_return = $_SESSION['photo_return'] ?? '';
if (!local_user()) {
if (!DI::userSession()->getLocalUserId()) {
DI::baseUrl()->redirect($photo_return);
// NOTREACHED
}
@ -97,7 +97,7 @@ function tagrm_content(App $a)
// NOTREACHED
}
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => DI::userSession()->getLocalUserId()]);
if (!DBA::isResult($item)) {
DI::baseUrl()->redirect($photo_return);
}

View File

@ -30,7 +30,7 @@ use Friendica\DI;
function uimport_post(App $a)
{
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -43,7 +43,7 @@ function uimport_post(App $a)
function uimport_content(App $a)
{
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
DI::sysmsg()->addNotice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
return;
}
@ -52,7 +52,7 @@ function uimport_content(App $a)
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
if ($total >= $max_dailies) {
Logger::notice('max daily registrations exceeded.');
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
DI::sysmsg()->addNotice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
return;
}
}

View File

@ -31,8 +31,8 @@ use Friendica\Util\Strings;
function unfollow_post(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('login');
// NOTREACHED
}
@ -46,29 +46,29 @@ function unfollow_content(App $a)
{
$base_return_path = 'contact';
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('login');
// NOTREACHED
}
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$url = trim($_REQUEST['url']);
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
local_user(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
DI::userSession()->getLocalUserId(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
Strings::normaliseLink($url), $url];
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
if (!Protocol::supportsFollow($contact['network'])) {
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
// NOTREACHED
}
@ -79,7 +79,7 @@ function unfollow_content(App $a)
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
if (!DBA::isResult($self)) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
@ -118,7 +118,7 @@ function unfollow_process(string $url)
{
$base_return_path = 'contact';
$uid = local_user();
$uid = DI::userSession()->getLocalUserId();
$owner = User::getOwnerDataById($uid);
if (!$owner) {
@ -131,7 +131,7 @@ function unfollow_process(string $url)
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
@ -146,6 +146,6 @@ function unfollow_process(string $url)
$notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
}
notice($notice_message);
DI::sysmsg()->addNotice($notice_message);
DI::baseUrl()->redirect($return_path);
}

View File

@ -30,7 +30,7 @@ use Friendica\Model\Contact;
function update_contact_content(App $a)
{
if (!empty(DI::args()->get(1)) && (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update'))) {
if (!empty(DI::args()->get(1)) && (!empty($_GET['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update'))) {
$contact = Contact::getById(DI::args()->get(1), ['id', 'deleted']);
if (DBA::isResult($contact) && empty($contact['deleted'])) {
DI::page()['aside'] = '';

View File

@ -24,11 +24,11 @@ use Friendica\App;
use Friendica\Core\System;
use Friendica\DI;
require_once("mod/notes.php");
require_once 'mod/notes.php';
function update_notes_content(App $a) {
$profile_uid = intval($_GET["p"]);
function update_notes_content(App $a)
{
$profile_uid = intval($_GET['p']);
/**
*

View File

@ -20,7 +20,7 @@
*/
use Friendica\App;
use Friendica\Core\Session;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -28,104 +28,109 @@ use Friendica\Model\Attach;
use Friendica\Model\User;
use Friendica\Util\Strings;
function wall_attach_post(App $a) {
$r_json = (!empty($_GET['response']) && $_GET['response']=='json');
function wall_attach_post(App $a)
{
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
if (DI::args()->getArgc() > 1) {
$nick = DI::args()->getArgv()[1];
$nick = DI::args()->getArgv()[1];
$owner = User::getOwnerDataByNick($nick);
if (!DBA::isResult($owner)) {
if ($r_json) {
Logger::warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
}
} else {
if ($r_json) {
Logger::warning('Argument count is zero or one (invalid)');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
}
$can_post = false;
$can_post = false;
$page_owner_uid = $owner['uid'];
$page_owner_cid = $owner['id'];
$community_page = $owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
if (local_user() && (local_user() == $page_owner_uid)) {
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
$contact_id = Session::getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
}
if (!$can_post) {
if ($r_json) {
Logger::warning('User does not have required permissions', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
}
notice(DI::l10n()->t('Permission denied.') . EOL );
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
System::exit();
}
if (empty($_FILES['userfile'])) {
if ($r_json) {
Logger::warning('No file uploaded (empty userfile)');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
System::exit();
}
$src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$tempFileName = $_FILES['userfile']['tmp_name'];
$fileName = basename($_FILES['userfile']['name']);
$fileSize = intval($_FILES['userfile']['size']);
$maxFileSize = DI::config()->get('system', 'maxfilesize');
$maxfilesize = DI::config()->get('system','maxfilesize');
/* Found html code written in text field of form,
* when trying to upload a file with filesize
* greater than upload_max_filesize. Cause is unknown.
/*
* Found html code written in text field of form, when trying to upload a
* file with filesize greater than upload_max_filesize. Cause is unknown.
* Then Filesize gets <= 0.
*/
if ($filesize <= 0) {
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(DI::l10n()->t('Or - did you try to upload an empty file?'));
@unlink($src);
if ($r_json) {
if ($fileSize <= 0) {
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' . DI::l10n()->t('Or - did you try to upload an empty file?');
Logger::warning($msg, ['fileSize' => $fileSize]);
@unlink($tempFileName);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
notice($msg);
DI::sysmsg()->addNotice($msg);
}
System::exit();
}
if ($maxfilesize && $filesize > $maxfilesize) {
$msg = DI::l10n()->t('File exceeds size limit of %s', Strings::formatBytes($maxfilesize));
@unlink($src);
if ($r_json) {
if ($maxFileSize && $fileSize > $maxFileSize) {
$msg = DI::l10n()->t('File exceeds size limit of %s', Strings::formatBytes($maxFileSize));
Logger::warning($msg, ['fileSize' => $fileSize]);
@unlink($tempFileName);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg . EOL;
echo $msg . '<br />';
}
System::exit();
}
$newid = Attach::storeFile($src, $page_owner_uid, $filename, '<' . $page_owner_cid . '>');
$newid = Attach::storeFile($tempFileName, $page_owner_uid, $fileName, '<' . $page_owner_cid . '>');
@unlink($src);
@unlink($tempFileName);
if ($newid === false) {
$msg = DI::l10n()->t('File upload failed.');
if ($r_json) {
$msg = DI::l10n()->t('File upload failed.');
Logger::warning($msg);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg . EOL;
echo $msg . '<br />';
}
System::exit();
}
if ($r_json) {
if ($isJson) {
System::jsonExit(['ok' => true, 'id' => $newid]);
}

View File

@ -27,7 +27,6 @@
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
@ -40,17 +39,18 @@ use Friendica\Util\Strings;
function wall_upload_post(App $a, $desktopmode = true)
{
Logger::info("wall upload: starting new upload");
Logger::info('wall upload: starting new upload');
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
if (DI::args()->getArgc() > 1) {
if (empty($_FILES['media'])) {
$nick = DI::args()->getArgv()[1];
$nick = DI::args()->getArgv()[1];
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
if (!DBA::isResult($user)) {
if ($r_json) {
Logger::warning('wall upload: user instance is not valid', ['user' => $user, 'nickname' => $nick]);
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
@ -59,7 +59,8 @@ function wall_upload_post(App $a, $desktopmode = true)
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID(), 'blocked' => false]);
}
} else {
if ($r_json) {
Logger:warning('Argument count is zero or one (invalid)');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
return;
@ -68,47 +69,50 @@ function wall_upload_post(App $a, $desktopmode = true)
/*
* Setup permissions structures
*/
$can_post = false;
$visitor = 0;
$can_post = false;
$visitor = 0;
$page_owner_uid = $user['uid'];
$default_cid = $user['id'];
$page_owner_nick = $user['nickname'];
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
$page_owner_uid = $user['uid'];
$default_cid = $user['id'];
$page_owner_nick = $user['nickname'];
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
if ((local_user()) && (local_user() == $page_owner_uid)) {
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
$contact_id = Session::getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
}
if (!$can_post) {
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
Logger::warning('No permission to upload files', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
$msg = DI::l10n()->t('Permission denied.');
if ($isJson) {
System::jsonExit(['error' => $msg]);
}
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice($msg);
System::exit();
}
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
if ($r_json) {
Logger::warning('Empty "userfile" and "media" field');
if ($isJson) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
System::exit();
}
$src = '';
$src = '';
$filename = '';
$filesize = 0;
$filetype = '';
if (!empty($_FILES['userfile'])) {
$src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
} elseif (!empty($_FILES['media'])) {
if (!empty($_FILES['media']['tmp_name'])) {
if (is_array($_FILES['media']['tmp_name'])) {
@ -143,29 +147,36 @@ function wall_upload_post(App $a, $desktopmode = true)
}
}
if ($src == "") {
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
if ($src == '') {
Logger::warning('File source (temporary file) cannot be determined');
$msg = DI::l10n()->t('Invalid request.');
if ($isJson) {
System::jsonExit(['error' => $msg]);
}
notice(DI::l10n()->t('Invalid request.'));
DI::sysmsg()->addNotice($msg);
System::exit();
}
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
Logger::info("File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype);
Logger::info('File upload:', [
'src' => $src,
'filename' => $filename,
'filesize' => $filesize,
'filetype' => $filetype,
]);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $filetype);
$image = new Image($imagedata, $filetype);
if (!$image->isValid()) {
$msg = DI::l10n()->t('Unable to process image.');
Logger::warning($msg, ['imagedata[]' => gettype($imagedata), 'filetype' => $filetype]);
@unlink($src);
if ($r_json) {
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg. EOL;
echo $msg . '<br />';
}
System::exit();
}
@ -177,10 +188,10 @@ function wall_upload_post(App $a, $desktopmode = true)
if ($max_length > 0) {
$image->scaleDown($max_length);
$filesize = strlen($image->asString());
Logger::info("File upload: Scaling picture to new size " . $max_length);
Logger::info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
}
$width = $image->getWidth();
$width = $image->getWidth();
$height = $image->getHeight();
$maximagesize = DI::config()->get('system', 'maximagesize');
@ -192,18 +203,18 @@ function wall_upload_post(App $a, $desktopmode = true)
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
$image->scaleDown($pixels);
$filesize = strlen($image->asString());
$width = $image->getWidth();
$height = $image->getHeight();
$width = $image->getWidth();
$height = $image->getHeight();
}
}
if ($filesize > $maximagesize) {
Logger::notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
@unlink($src);
if ($r_json) {
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg. EOL;
echo $msg . '<br />';
}
System::exit();
}
@ -224,10 +235,11 @@ function wall_upload_post(App $a, $desktopmode = true)
if (!$r) {
$msg = DI::l10n()->t('Image upload failed.');
if ($r_json) {
Logger::warning('Photo::store() failed', ['r' => $r]);
if ($isJson) {
System::jsonExit(['error' => $msg]);
} else {
echo $msg. EOL;
echo $msg . '<br />';
}
System::exit();
}
@ -251,32 +263,34 @@ function wall_upload_post(App $a, $desktopmode = true)
if (!$desktopmode) {
$photo = Photo::selectFirst(['id', 'datasize', 'width', 'height', 'type'], ['resource-id' => $resource_id], ['order' => ['width']]);
if (!$photo) {
if ($r_json) {
System::jsonExit(['error' => '']);
Logger::warning('Cannot find photo in database', ['resource-id' => $resource_id]);
if ($isJson) {
System::jsonExit(['error' => 'Cannot find photo']);
}
return false;
}
$picture = [];
$picture["id"] = $photo["id"];
$picture["size"] = $photo["datasize"];
$picture["width"] = $photo["width"];
$picture["height"] = $photo["height"];
$picture["type"] = $photo["type"];
$picture["albumpage"] = DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id;
$picture["picture"] = DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt();
$picture["preview"] = DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt();
$picture = [
'id' => $photo['id'],
'size' => $photo['datasize'],
'width' => $photo['width'],
'height' => $photo['height'],
'type' => $photo['type'],
'albumpage' => DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id,
'picture' => DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt(),
'preview' => DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt(),
];
if ($r_json) {
if ($isJson) {
System::jsonExit(['picture' => $picture]);
}
Logger::info("upload done");
Logger::info('upload done');
return $picture;
}
Logger::info("upload done");
Logger::info('upload done');
if ($r_json) {
if ($isJson) {
System::jsonExit(['ok' => true]);
}

View File

@ -1,146 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Mail;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
function wallmessage_post(App $a) {
$replyto = Profile::getMyURL();
if (!$replyto) {
notice(DI::l10n()->t('Permission denied.'));
return;
}
$subject = trim($_REQUEST['subject'] ?? '');
$body = Strings::escapeHtml(trim($_REQUEST['body'] ?? ''));
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
if ((! $recipient) || (! $body)) {
return;
}
$user = User::getByNickname($recipient);
if (empty($r)) {
Logger::notice('wallmessage: no recipient');
return;
}
if (!$user['unkmail']) {
notice(DI::l10n()->t('Permission denied.'));
return;
}
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
if ($total > $user['cntunkmail']) {
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
return;
}
$ret = Mail::sendWall($user, $body, $subject, $replyto);
switch ($ret) {
case -1:
notice(DI::l10n()->t('No recipient selected.'));
break;
case -2:
notice(DI::l10n()->t('Unable to check your home location.'));
break;
case -3:
notice(DI::l10n()->t('Message could not be sent.'));
break;
case -4:
notice(DI::l10n()->t('Message collection failure.'));
break;
}
DI::baseUrl()->redirect('profile/'.$user['nickname']);
}
function wallmessage_content(App $a) {
if (!Profile::getMyURL()) {
notice(DI::l10n()->t('Permission denied.'));
return;
}
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
if (!$recipient) {
notice(DI::l10n()->t('No recipient.'));
return;
}
$user = User::getByNickname($recipient);
if (empty($user)) {
notice(DI::l10n()->t('No recipient.'));
Logger::notice('wallmessage: no recipient');
return;
}
if (!$user['unkmail']) {
notice(DI::l10n()->t('Permission denied.'));
return;
}
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
if ($total > $user['cntunkmail']) {
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
return;
}
$tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => DI::baseUrl()->get(true),
'$nickname' => $user['nickname'],
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
]);
$tpl = Renderer::getMarkupTemplate('wallmessage.tpl');
$o = Renderer::replaceMacros($tpl, [
'$header' => DI::l10n()->t('Send Private Message'),
'$subheader' => DI::l10n()->t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']),
'$to' => DI::l10n()->t('To:'),
'$subject' => DI::l10n()->t('Subject:'),
'$recipname' => $user['username'],
'$nickname' => $user['nickname'],
'$subjtxt' => $_REQUEST['subject'] ?? '',
'$text' => $_REQUEST['body'] ?? '',
'$readonly' => '',
'$yourmessage'=> DI::l10n()->t('Your message:'),
'$parent' => '',
'$upload' => DI::l10n()->t('Upload photo'),
'$insert' => DI::l10n()->t('Insert web link'),
'$wait' => DI::l10n()->t('Please wait')
]);
return $o;
}

View File

@ -29,7 +29,7 @@ return [
// ****************************************************************
'config' => [
'hostname' => 'friendica.local',
'hostname' => '192.168.56.10',
'admin_email' => 'admin@friendica.local',
'sitename' => 'Friendica Social Network',
'register_policy' => \Friendica\Module\Register::OPEN,

View File

@ -19,7 +19,6 @@ static/
vendor/
view/
.htaccess-dist
boot.php
CHANGELOG
CREDITS.txt
database.sql

View File

@ -1,6 +1,6 @@
Contact: mailto:info@friendi.ca
Expires: Sun, 31 Dec 2022 23:59 +0000
Expires: Sun, 30 Jun 2023 23:59 +0000
Preferred-Languages: en

View File

@ -26,6 +26,7 @@ use Friendica\App\Arguments;
use Friendica\App\BaseURL;
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\Core\Config\Factory\Config;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Module\Maintenance;
use Friendica\Security\Authentication;
use Friendica\Core\Config\ValueObject\Cache;
@ -58,6 +59,10 @@ use Psr\Log\LoggerInterface;
*/
class App
{
const PLATFORM = 'Friendica';
const CODENAME = 'Giant Rhubarb';
const VERSION = '2022.12-dev';
// Allow themes to control internal parameters
// by changing App values in theme.php
private $theme_info = [
@ -123,6 +128,11 @@ class App
*/
private $pConfig;
/**
* @var IHandleUserSessions
*/
private $session;
/**
* Set the user ID
*
@ -147,7 +157,7 @@ class App
public function isLoggedIn(): bool
{
return local_user() && $this->user_id && ($this->user_id == local_user());
return $this->session->getLocalUserId() && $this->user_id && ($this->user_id == $this->session->getLocalUserId());
}
/**
@ -161,7 +171,7 @@ class App
$adminlist = explode(',', str_replace(' ', '', $admin_email));
return local_user() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
return $this->session->getLocalUserId() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
}
/**
@ -324,8 +334,9 @@ class App
* @param L10n $l10n The translator instance
* @param App\Arguments $args The Friendica Arguments of the call
* @param IManagePersonalConfigValues $pConfig Personal configuration
* @param IHandleUserSessions $session The (User)Session handler
*/
public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig)
public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session)
{
$this->database = $database;
$this->config = $config;
@ -336,6 +347,7 @@ class App
$this->l10n = $l10n;
$this->args = $args;
$this->pConfig = $pConfig;
$this->session = $session;
$this->load();
}
@ -347,6 +359,11 @@ class App
{
set_time_limit(0);
// Normally this constant is defined - but not if "pcntl" isn't installed
if (!defined('SIGTERM')) {
define('SIGTERM', 15);
}
// Ensure that all "strtotime" operations do run timezone independent
date_default_timezone_set('UTC');
@ -406,7 +423,7 @@ class App
}
// Specific mobile theme override
if (($this->mode->isMobile() || $this->mode->isTablet()) && Core\Session::get('show-mobile', true)) {
if (($this->mode->isMobile() || $this->mode->isTablet()) && $this->session->get('show-mobile', true)) {
$user_mobile_theme = $this->getCurrentMobileTheme();
// --- means same mobile theme as desktop
@ -478,16 +495,16 @@ class App
$page_theme = null;
// Find the theme that belongs to the user whose stuff we are looking at
if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
if (!empty($this->profile_owner) && ($this->profile_owner != $this->session->getLocalUserId())) {
// Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server
$user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_owner]);
if ($this->database->isResult($user) && !local_user()) {
if ($this->database->isResult($user) && !$this->session->getLocalUserId()) {
$page_theme = $user['theme'];
}
}
$theme_name = $page_theme ?: Core\Session::get('theme', $system_theme);
$theme_name = $page_theme ?: $this->session->get('theme', $system_theme);
$theme_name = Strings::sanitizeFilePathItem($theme_name);
if ($theme_name
@ -511,15 +528,15 @@ class App
$page_mobile_theme = null;
// Find the theme that belongs to the user whose stuff we are looking at
if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
if (!empty($this->profile_owner) && ($this->profile_owner != $this->session->getLocalUserId())) {
// Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server
if (!local_user()) {
if (!$this->session->getLocalUserId()) {
$page_mobile_theme = $this->pConfig->get($this->profile_owner, 'system', 'mobile-theme');
}
}
$mobile_theme_name = $page_mobile_theme ?: Core\Session::get('mobile-theme', $system_mobile_theme);
$mobile_theme_name = $page_mobile_theme ?: $this->session->get('mobile-theme', $system_mobile_theme);
$mobile_theme_name = Strings::sanitizeFilePathItem($mobile_theme_name);
if ($mobile_theme_name == '---'
@ -586,7 +603,7 @@ class App
$this->profiler->set(microtime(true), 'classinit');
$moduleName = $this->args->getModuleName();
$page->setLogging($this->args->getCommand(), $this->args->getMethod());
$page->setLogging($this->args->getMethod(), $this->args->getModuleName(), $this->args->getCommand());
try {
// Missing DB connection: ERROR
@ -611,14 +628,14 @@ class App
}
// ZRL
if (!empty($_GET['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !local_user()) {
if (!empty($_GET['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !$this->session->getLocalUserId()) {
// Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') &&
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), '/profile/')) {
if (Core\Session::get('visitor_home') != $_GET['zrl']) {
Core\Session::set('my_url', $_GET['zrl']);
Core\Session::set('authenticated', 0);
if ($this->session->get('visitor_home') != $_GET['zrl']) {
$this->session->set('my_url', $_GET['zrl']);
$this->session->set('authenticated', 0);
$remote_contact = Contact::getByURL($_GET['zrl'], false, ['subscribe']);
if (!empty($remote_contact['subscribe'])) {
@ -719,7 +736,7 @@ class App
$response = $module->run($input);
$this->profiler->set(microtime(true) - $timestamp, 'content');
if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML) {
$page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig);
$page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $this->session->getLocalUserId());
} else {
$page->exit($response);
}

View File

@ -80,8 +80,9 @@ class Page implements ArrayAccess
private $basePath;
private $timestamp = 0;
private $command = '';
private $method = '';
private $module = '';
private $command = '';
/**
* @param string $basepath The Page basepath
@ -92,21 +93,25 @@ class Page implements ArrayAccess
$this->basePath = $basepath;
}
public function setLogging(string $command, string $method)
public function setLogging(string $method, string $module, string $command)
{
$this->command = $command;
$this->method = $method;
$this->module = $module;
$this->command = $command;
}
public function logRuntime(IManageConfigValues $config, string $origin = '')
{
if (in_array($this->command, $config->get('system', 'runtime_ignore'))) {
$ignore = $config->get('system', 'runtime_ignore');
if (in_array($this->module, $ignore) || in_array($this->command, $ignore)) {
return;
}
$runtime = number_format(microtime(true) - $this->timestamp, 3);
$signature = !empty($_SERVER['HTTP_SIGNATURE']);
$load = number_format(System::currentLoad(), 2);
$runtime = number_format(microtime(true) - $this->timestamp, 3);
if ($runtime > $config->get('system', 'runtime_loglimit')) {
Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime, 'origin' => $origin]);
Logger::debug('Runtime', ['method' => $this->method, 'module' => $this->module, 'runtime' => $runtime, 'load' => $load, 'origin' => $origin, 'signature' => $signature, 'request' => $_SERVER['REQUEST_URI'] ?? '']);
}
}
@ -197,7 +202,7 @@ class Page implements ArrayAccess
*/
public function registerStylesheet(string $path, string $media = 'screen')
{
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
$path = Network::appendQueryParam($path, ['v' => App::VERSION]);
if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) {
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
@ -216,17 +221,18 @@ class Page implements ArrayAccess
* - Infinite scroll data
* - head.tpl template
*
* @param App $app The Friendica App instance
* @param Arguments $args The Friendica App Arguments
* @param L10n $l10n The l10n language instance
* @param IManageConfigValues $config The Friendica configuration
* @param IManagePersonalConfigValues $pConfig The Friendica personal configuration (for user)
* @param App $app The Friendica App instance
* @param Arguments $args The Friendica App Arguments
* @param L10n $l10n The l10n language instance
* @param IManageConfigValues $config The Friendica configuration
* @param IManagePersonalConfigValues $pConfig The Friendica personal configuration (for user)
* @param int $localUID The local user id
*
* @throws HTTPException\InternalServerErrorException
*/
private function initHead(App $app, Arguments $args, L10n $l10n, IManageConfigValues $config, IManagePersonalConfigValues $pConfig)
private function initHead(App $app, Arguments $args, L10n $l10n, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, int $localUID)
{
$interval = ((local_user()) ? $pConfig->get(local_user(), 'system', 'update_interval') : 40000);
$interval = ($localUID ? $pConfig->get($localUID, 'system', 'update_interval') : 40000);
// If the update is 'deactivated' set it to the highest integer number (~24 days)
if ($interval < 0) {
@ -271,8 +277,8 @@ class Page implements ArrayAccess
* being first
*/
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [
'$local_user' => local_user(),
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
'$local_user' => $localUID,
'$generator' => 'Friendica' . ' ' . App::VERSION,
'$delitem' => $l10n->t('Delete this item?'),
'$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
'$update_interval' => $interval,
@ -390,7 +396,7 @@ class Page implements ArrayAccess
*/
public function registerFooterScript($path)
{
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
$path = Network::appendQueryParam($path, ['v' => App::VERSION]);
$url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
@ -438,10 +444,11 @@ class Page implements ArrayAccess
* @param L10n $l10n The l10n language class
* @param IManageConfigValues $config The Configuration of this node
* @param IManagePersonalConfigValues $pconfig The personal/user configuration
* @param int $localUID The UID of the local user
*
* @throws HTTPException\InternalServerErrorException|HTTPException\ServiceUnavailableException
*/
public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, ResponseInterface $response, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig)
public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, ResponseInterface $response, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig, int $localUID)
{
$moduleName = $args->getModuleName();
@ -475,7 +482,7 @@ class Page implements ArrayAccess
* all the module functions have executed so that all
* theme choices made by the modules can take effect.
*/
$this->initHead($app, $args, $l10n, $config, $pconfig);
$this->initHead($app, $args, $l10n, $config, $pconfig, $localUID);
/* Build the page ending -- this is stuff that goes right before
* the closing </body> tag
@ -538,7 +545,7 @@ class Page implements ArrayAccess
$page = $this->page;
header("X-Friendica-Version: " . FRIENDICA_VERSION);
header("X-Friendica-Version: " . App::VERSION);
header("Content-type: text/html; charset=utf-8");
if ($config->get('system', 'hsts') && ($baseURL->getSSLPolicy() == BaseURL::SSL_POLICY_FULL)) {

View File

@ -34,6 +34,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Lock\Capability\ICanLock;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\LegacyModule;
use Friendica\Module\HTTPException\MethodNotAllowed;
use Friendica\Module\HTTPException\PageNotFound;
@ -98,6 +99,9 @@ class Router
/** @var LoggerInterface */
private $logger;
/** @var bool */
private $isLocalUser;
/** @var float */
private $dice_profiler_threshold;
@ -120,9 +124,10 @@ class Router
* @param Arguments $args
* @param LoggerInterface $logger
* @param Dice $dice
* @param IHandleUserSessions $userSession
* @param RouteCollector|null $routeCollector
*/
public function __construct(array $server, string $baseRoutesFilepath, L10n $l10n, ICanCache $cache, ICanLock $lock, IManageConfigValues $config, Arguments $args, LoggerInterface $logger, Dice $dice, RouteCollector $routeCollector = null)
public function __construct(array $server, string $baseRoutesFilepath, L10n $l10n, ICanCache $cache, ICanLock $lock, IManageConfigValues $config, Arguments $args, LoggerInterface $logger, Dice $dice, IHandleUserSessions $userSession, RouteCollector $routeCollector = null)
{
$this->baseRoutesFilepath = $baseRoutesFilepath;
$this->l10n = $l10n;
@ -133,6 +138,7 @@ class Router
$this->dice = $dice;
$this->server = $server;
$this->logger = $logger;
$this->isLocalUser = !empty($userSession->getLocalUserId());
$this->dice_profiler_threshold = $config->get('system', 'dice_profiler_threshold', 0);
$this->routeCollector = $routeCollector ?? new RouteCollector(new Std(), new GroupCountBased());
@ -308,7 +314,7 @@ class Router
if (Addon::isEnabled($moduleName) && file_exists("addon/{$moduleName}/{$moduleName}.php")) {
//Check if module is an app and if public access to apps is allowed or not
$privateapps = $this->config->get('config', 'private_addons', false);
if ((!local_user()) && Hook::isAddonApp($moduleName) && $privateapps) {
if (!$this->isLocalUser && Hook::isAddonApp($moduleName) && $privateapps) {
throw new MethodNotAllowedException($this->l10n->t("You must be logged in to use addons. "));
} else {
include_once "addon/{$moduleName}/{$moduleName}.php";
@ -339,7 +345,7 @@ class Router
if ($this->dice_profiler_threshold > 0) {
$dur = floatval(microtime(true) - $stamp);
if ($dur >= $this->dice_profiler_threshold) {
$this->logger->warning('Dice module creation lasts too long.', ['duration' => round($dur, 3), 'module' => $module_class, 'parameters' => $module_parameters]);
$this->logger->notice('Dice module creation lasts too long.', ['duration' => round($dur, 3), 'module' => $module_class, 'parameters' => $module_parameters]);
}
}
}

View File

@ -389,7 +389,7 @@ abstract class BaseModule implements ICanHandleRequests
public static function getFormSecurityStandardErrorMessage(): string
{
return DI::l10n()->t("The form security token was not correct. This probably happened because the form has been opened for too long \x28>3 hours\x29 before submitting it.") . EOL;
return DI::l10n()->t("The form security token was not correct. This probably happened because the form has been opened for too long \x28>3 hours\x29 before submitting it.");
}
public static function checkFormSecurityTokenRedirectOnError(string $err_redirect, string $typename = '', string $formname = 'form_security_token')
@ -397,7 +397,7 @@ abstract class BaseModule implements ICanHandleRequests
if (!self::checkFormSecurityToken($typename, $formname)) {
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
notice(self::getFormSecurityStandardErrorMessage());
DI::sysmsg()->addNotice(self::getFormSecurityStandardErrorMessage());
DI::baseUrl()->redirect($err_redirect);
}
}

View File

@ -75,9 +75,8 @@ HELP;
$arr = [];
$files = array_merge(
['index.php', 'boot.php'],
['index.php'],
glob('mod/*'),
glob('include/*'),
glob('addon/*/*'),
$this->globRecursive('src')
);

View File

@ -23,6 +23,7 @@ namespace Friendica\Console;
use Friendica\Core\L10n;
use Friendica\Database\Database;
use Friendica\Model\Contact;
/**
* tool to find and merge duplicated contact entries.
@ -137,7 +138,7 @@ HELP;
$this->updateTable('post-thread-user', 'contact-id', $from, $to, false);
$this->updateTable('user-contact', 'cid', $from, $to, true);
if (!$this->dba->delete('contact', ['id' => $from])) {
if (!Contact::deleteById($from)) {
$this->err($this->l10n->t('Deletion of id %d failed', $from));
} else {
$this->out($this->l10n->t('Deletion of id %d was successful', $from));

View File

@ -46,7 +46,7 @@ class MoveToAvatarCache extends \Asika\SimpleConsole\Console
/**
* @var $baseurl Friendica\App\BaseURL
*/
private $baseurl;
private $baseUrl;
/**
* @var L10n
@ -75,12 +75,12 @@ HELP;
return $help;
}
public function __construct(\Friendica\Database\Database $dba, BaseURL $baseurl, L10n $l10n, IManageConfigValues $config, array $argv = null)
public function __construct(\Friendica\Database\Database $dba, BaseURL $baseUrl, L10n $l10n, IManageConfigValues $config, array $argv = null)
{
parent::__construct($argv);
$this->dba = $dba;
$this->baseurl = $baseurl;
$this->baseUrl = $baseUrl;
$this->l10n = $l10n;
$this->config = $config;
}
@ -94,7 +94,7 @@ HELP;
$fields = ['id', 'avatar', 'photo', 'thumb', 'micro', 'uri-id', 'url', 'avatar', 'network'];
$condition = ["NOT `self` AND `avatar` != ? AND `photo` LIKE ? AND `uid` = ? AND `uri-id` != ? AND NOT `uri-id` IS NULL AND NOT `network` IN (?, ?)",
'', $this->baseurl->get() . '/photo/%', 0, 0, Protocol::MAIL, Protocol::FEED];
'', $this->baseUrl->get() . '/photo/%', 0, 0, Protocol::MAIL, Protocol::FEED];
$count = 0;
$total = $this->dba->count('contact', $condition);

Some files were not shown because too many files have changed in this diff Show More