Compare commits

...

132 Commits

Author SHA1 Message Date
Hypolite Petovan cfff03f6e2 [v2.4.2] Bump version number for release 2024-03-07 14:18:49 -05:00
Tobias Diekershoff 4524ad166b Merge pull request 'Move Visit server link to server name' (#103) from MrPetovan/friendica-directory:enhancement/100-move-visit-server-link into stable
Reviewed-on: #103
2024-03-07 15:48:26 +01:00
Hypolite Petovan 2ffb047736 Move Visit server link to server name 2024-03-07 09:42:45 -05:00
heluecht f4bff37432 Merge pull request 'Update source code link to point to Friendica's Forgejo' (#101) from MrPetovan/friendica-directory:enhancement/97-source-code-link into stable
Reviewed-on: #101
2024-03-07 15:36:49 +01:00
heluecht 62c6c0f1cc Merge pull request 'Change icon for Approval registration policy from dungeon door to stamp' (#102) from MrPetovan/friendica-directory:enhancement/99-unstable-version-icon into stable
Reviewed-on: #102
2024-03-07 15:35:43 +01:00
Hypolite Petovan 5f79768a6b Change icon for unstable version from poop to bug 2024-03-07 09:23:51 -05:00
Hypolite Petovan 08950be588 Change icon for Approval registration policy from dungeon door to stamp 2024-03-07 09:23:36 -05:00
Hypolite Petovan 9d77067e79 Update source code link to point to Friendica's Forgejo 2024-03-07 09:21:03 -05:00
Tobias Diekershoff 13b95e22da Merge pull request '[Composer] Change gofabian/negotiation-middleware dependency requirement to support PHP 8.2' (#96) from MrPetovan/friendica-directory:bug/php-8 into stable
Reviewed-on: #96
2023-08-09 07:01:21 +02:00
Hypolite Petovan 9d296b9f5d [Composer] Change gofabian/negotiation-middleware dependency requirement to support PHP 8
- Add now-explicit laminas/laminas-zendframework-bridge dependency
- Bump PHP version requirement to 7.3.0
- Updating willdurand/negotiation (v2.3.1 => 3.1.0) (PHP 8 compatibility)
- Updating psr/http-message (1.0.1 => 1.1)
- Removing gofabian/negotiation-middleware (v0.1.3)
- Installing gofabian/negotiation-middleware (dev-master 4d3cda5)
- Updating gettext/languages (2.9.0 => 2.10.0)
- Updating gettext/gettext (v4.8.6 => v4.8.8)
- Updating guzzlehttp/psr7 (1.8.5 => 1.9.1)
- Updating guzzlehttp/promises (1.5.1 => 1.5.3)
- Updating symfony/polyfill-php72 (v1.26.0 => v1.27.0)
- Updating symfony/polyfill-intl-normalizer (v1.26.0 => v1.27.0)
- Updating symfony/polyfill-intl-idn (v1.26.0 => v1.27.0)
- Updating guzzlehttp/guzzle (6.5.6 => 6.5.8)
- Updating laminas/laminas-escaper (2.6.1 => 2.9.0)
- Updating laminas/laminas-zendframework-bridge (1.1.1 => 1.4.1)
- Updating masterminds/html5 (2.7.5 => 2.8.0)
- Updating monolog/monolog (1.26.1 => 1.27.1)
- Updating psr/container (1.0.0 => 1.1.1)
- Updating pimple/pimple (v3.2.3 => v3.5.0)
- Updating slim/slim (3.12.3 => 3.12.5)
- Updating pear/pear-core-minimal (v1.10.11 => v1.10.13)
2023-07-31 01:24:50 +02:00
Hypolite Petovan bf85c8f986 Catch rare exception receiving line folding characters in header value of redirected request 2023-07-31 01:17:33 +02:00
Hypolite Petovan 064fd922e7 Add default profile picture path dependency
- Update default profile picture
2023-07-31 01:11:33 +02:00
Hypolite Petovan 95ffadb19f Fix ternary operator ambiguity deprecation in Utils\L10n 2023-07-31 01:10:37 +02:00
Tobias Diekershoff 8bd1cb11ae Merge pull request 'Rename "forum" to "group"' (#94) from MrPetovan/friendica-directory:task/rename-forum-to-group into stable
Reviewed-on: #94
2023-06-05 06:37:27 +02:00
Hypolite Petovan aade2ec534 Rename "forum" to "group"
- This reflects a change in Friendica Core
2023-06-04 00:16:38 -04:00
Hypolite Petovan f854d7d5f7 Fix several PHP messages
- Add logging for exceptions
2023-03-12 17:49:44 -04:00
Tobias Diekershoff 230f17ef36 Merge pull request 'Normalize HTTP client user agent' (#90) from MrPetovan/friendica-directory:task/89-normalize-user-agent into stable
Reviewed-on: #90
2022-06-07 05:40:29 +00:00
Hypolite Petovan 30f6e6f5de [Composer] Remove unused dependency byjg/webrequest 2022-06-06 02:23:57 -04:00
Hypolite Petovan d1a72232b3 Replace ByJG\WebRequest by GuzzleHttp\ClientInterface 2022-06-06 02:22:56 -04:00
Hypolite Petovan 9ff681a460 Fix database error with false bolean value in profile table 2022-06-06 02:22:39 -04:00
Hypolite Petovan 0ee5bf55b1 Replace direct curl uses with Guzzle HTTP client
- Add http dependency with custom User Agent
- Simplify profile poll to remove the second profile call to check availability
- Remove obsolete Network::fetchURL and Network::testURL
2022-06-06 02:22:37 -04:00
Hypolite Petovan 5829108c0e [Composer] Require guzzlehttp/guzzle:^6.5 2022-06-06 01:32:00 -04:00
Hypolite Petovan 91aa66ed77 [v2.4.1] Bump version number for release 2022-05-12 14:18:43 -04:00
Hypolite Petovan 7fdbaa3678 Don't encode the zrl parameter in external links
- Fix a "Forbidden" issue with /remote_follow links
2022-05-12 14:18:19 -04:00
Hypolite Petovan df660b66c9 [v2.4.0] Bump version number for release 2022-05-12 09:15:19 -04:00
heluecht 3f38b3adea Merge pull request 'Remove obsolete profile.dfrn_request field' (#87) from MrPetovan/friendica-directory:task/86-remove-dfrn_request into stable
Reviewed-on: #87
2022-05-11 04:17:41 +00:00
Hypolite Petovan e65bb660ce [Database v0010] Drop unused column profile.dfrn_request 2022-05-07 16:10:43 -04:00
Hypolite Petovan a5700cb2c9 Remove references to dfrn_request 2022-05-07 16:10:43 -04:00
Hypolite Petovan 2627b54349 Replace dfrn_request by subscribe URL when available for the follow link
- Falls back to the `/remote_follow` module available since Friendica version 2020.03
- Falls back to the profile URL
- Remove unused atlas dependency in a couple API controllers
2022-05-07 16:10:42 -04:00
Hypolite Petovan 8988ad9f9d Add subscribe URL retrieval to server poll 2022-05-07 16:09:30 -04:00
Hypolite Petovan 7d5012e72e [Database v0009] Add server.subscribe_url field 2022-05-07 16:09:30 -04:00
Hypolite Petovan b0142f6ab2 Add optional version parameter to console updatedb 2022-05-07 16:09:29 -04:00
Hypolite Petovan cd809f7646 Remove mention of non-existent console parameters in Install and UpdateDb 2022-05-07 16:09:29 -04:00
Hypolite Petovan 2aba91d42c Add HTML link to profile to account name
- Normalize white space in HTML
2022-05-07 16:09:27 -04:00
Hypolite Petovan 2e84f5aa7b Merge pull request 'added DA DK translation THX atjn' (#88) from tobias/friendica-directory:20220501-daDK into stable
Reviewed-on: #88
2022-05-04 21:45:51 +00:00
Tobias Diekershoff 1ebddb042f
PL translation updated THX strebski 2022-05-03 09:17:55 +02:00
Tobias Diekershoff 0344c77336
added DA DK translation THX atjn 2022-05-01 20:17:13 +02:00
Hypolite Petovan 5a16bcb57c Merge pull request 'PL translation updated THX strebski' (#85) from tobias/friendica-directory:20220318-pl into stable
Reviewed-on: #85
2022-04-25 11:27:41 +00:00
Tobias Diekershoff 146d4e6374
PL translation updated THX strebski 2022-03-18 17:41:59 +01:00
Hypolite Petovan ef91f43be0 [v2.3.5] Bump version number for release 2022-01-23 06:13:16 -05:00
Hypolite Petovan a3a5bd8ab4 Merge pull request 'added SV translation THX Kristoffer Grundström' (#84) from tobias/friendica-directory:20220122-sv into stable
Reviewed-on: #84
2022-01-23 01:27:15 +00:00
Tobias Diekershoff c34fcd11f8 added Swedish to the languages array 2022-01-22 19:09:24 +01:00
Tobias Diekershoff 1356001334 added SV translation THX Kristoffer Grundström 2022-01-22 19:08:37 +01:00
Hypolite Petovan b344935edc [v2.3.4] Bump version number for release 2022-01-10 02:24:09 -05:00
Hypolite Petovan 5de396bc67 Add Hungarian to the available languages 2022-01-09 18:16:15 -05:00
Hypolite Petovan fe9b12164d [v2.3.3] Bump version number for release 2021-12-29 18:57:18 +01:00
Hypolite Petovan 6ccbeef59c [Composer] Updated dependencies before release
- Updating atlas/pdo (1.1.2 => 1.2.0)
  - Updating gettext/languages (2.6.0 => 2.9.0)
  - Updating gettext/gettext (v4.8.2 => v4.8.6)
  - Updating masterminds/html5 (2.7.1 => 2.7.5)
  - Updating psr/log (1.1.3 => 1.1.4)
  - Updating monolog/monolog (1.25.4 => 1.26.1)
  - Updating sarahman/simple-filesystem-cache (1.0.1 => 1.0.2)
  - Updating seld/cli-prompt (1.0.3 => 1.0.4)
  - Updating bower-asset/fontawesome (5.13.1 => 5.15.4)
  - Updating laminas/laminas-zendframework-bridge (1.0.4 => 1.1.1)
  - Updating pear/pear_exception (v1.0.1 => v1.0.2)
  - Updating pear/pear-core-minimal (v1.10.10 => v1.10.11)
2021-12-29 17:24:24 +01:00
Hypolite Petovan 4e3dcaf331 Merge pull request 'added HU translation' (#82) from tobias/friendica-directory:20211206-hu into stable
Reviewed-on: #82
2021-12-06 19:41:57 +00:00
Tobias Diekershoff ca605b8f23 added HU translation
fixes #73
2021-12-06 20:29:32 +01:00
Hypolite Petovan 13733e2f6c Merge pull request 'AR translation update THX abidin toumi' (#81) from tobias/friendica-directory:20211030-ar into stable
Reviewed-on: #81
2021-10-30 12:37:07 +00:00
Tobias Diekershoff d22b656a46 AR translation update THX abidin toumi 2021-10-30 08:27:49 +02:00
Tobias Diekershoff b3a8ea85f1 Merge pull request '[Composer] Update mrpetovan/net_ping to version 1.2.1' (#80) from MrPetovan/friendica-directory:task/79-composer-dependencies into stable
Reviewed-on: #80
2021-09-16 05:15:07 +00:00
Hypolite Petovan 2a747cbb06 [Composer] Update mrpetovan/net_ping to version 1.2.1
- Suppresses a couple of Deprecation Notices when running Composer
2021-09-15 21:56:00 -04:00
Hypolite Petovan ffea0fcbdb Add Composer 1.* binary to project
- It is required to keep the fxp/composer-asset-plugin support
2021-09-15 21:16:38 -04:00
Hypolite Petovan 1507bfdcf8
Merge pull request #78 from tobiasd/20210715-gd
add translation for Gaelic, Scottish
2021-07-15 15:40:26 -04:00
Tobias Diekershoff b8332ac785 added Gaelic, Scottish to the language array 2021-07-15 15:10:57 +02:00
Tobias Diekershoff f707df488b added Gaelic, Scottish translation THX GunChleoc 2021-07-15 15:05:44 +02:00
Michael Vogel 750e369f57
Merge pull request #77 from MrPetovan/bug/76-remove-at-sign-fulltext-search
Remove at sign (@) from fulltext query string
2021-06-22 16:05:21 +02:00
Hypolite Petovan 4d7067b381 Remove at sign (@) from fulltext query string
- InnoDB uses it as a special character and it can't be escaped
2021-06-21 11:15:57 -04:00
Hypolite Petovan 7112c65166
Merge pull request #71 from Quix0r/fixes/timeout-class-reference
Fixes:
2020-10-25 22:52:29 -04:00
Roland Häder 193b01cccd
Used \Some\Foo::class instead of '\Some\Foo' which type-safe and easier to find by your editor/IDE
Signed-off-by: Roland Häder <roland@mxchange.org>
2020-10-26 01:19:41 +01:00
Tobias Diekershoff 9b4961e2cc
Merge pull request #68 from MrPetovan/task/3-add-server-language-filter
Add language filter to server list
2020-09-27 21:45:41 +02:00
Hypolite Petovan cb0bfae1ab [Composer] Add expected ext-pdo dependency 2020-09-27 15:39:09 -04:00
Hypolite Petovan 16d1962324 Add language filter to server list 2020-09-27 15:39:09 -04:00
Hypolite Petovan e68b68110b Create new popular server languages widget
- Rename popular profile widget class and template
2020-09-27 15:39:08 -04:00
Tobias Diekershoff a1921c999d
Merge pull request #67 from MrPetovan/task/31-add-limit-to-search
Add page size parameter to search
2020-09-27 20:05:17 +02:00
Hypolite Petovan 959f526cb4 Add page size parameter to search
- Update API call documentation
2020-09-27 13:41:40 -04:00
Tobias Diekershoff 72d5e68c96
Merge pull request #66 from MrPetovan/task/34-no-desc-health-cap
Cap health score if server doesn't have a description
2020-09-27 19:16:49 +02:00
Hypolite Petovan aa83091458 Cap health if server doesn't have a description 2020-09-27 12:51:34 -04:00
Michael Vogel 4205323d31
Merge pull request #65 from MrPetovan/task/36-display-registration-policy
Display registration policy in server panel
2020-09-27 18:03:12 +02:00
Hypolite Petovan 7b906d5e33 Updated base translation file after adding new translation strings 2020-09-27 11:58:07 -04:00
Hypolite Petovan 35194f8110 Display registration policy in server panel
- Add title to health score badge
- Add translation for users badge
2020-09-27 11:58:06 -04:00
Tobias Diekershoff 520ddf5a8c
Merge pull request #63 from MrPetovan/task/54-no-ping-penalty
Factor in the unavailability of ping in the health score
2020-09-27 17:56:49 +02:00
Tobias Diekershoff a24a7d866c
Merge pull request #64 from MrPetovan/task/40-add-account-types
Add additional account types to the profile filter
2020-09-27 17:43:18 +02:00
Hypolite Petovan f1b960c4eb Add additional account types to the profile filter 2020-09-27 11:31:18 -04:00
Hypolite Petovan 0ce9dda5f6 Factor in the unavailability of ping in the health score
- No available ping limits the maximum health score a server can have
2020-09-27 11:08:39 -04:00
Tobias Diekershoff 360c421796
Merge pull request #62 from MrPetovan/task/39-search-match-username
Add missing column in profile fulltext index
2020-09-27 14:46:56 +02:00
Hypolite Petovan b7eab197b5 Update API profile search request to match updated fulltext index definition 2020-09-27 08:39:31 -04:00
Hypolite Petovan 3939800068 [Database v0008b] Add missing column in fulltext index
- Add minimal SQL query to downgrade SQL script to avoid empty query errors
2020-09-27 08:39:18 -04:00
Michael Vogel 96dec7c4df
Merge pull request #60 from MrPetovan/task/39-search-match-username
Profile search now matches username, not full profile URL
2020-09-27 00:47:15 +02:00
Hypolite Petovan d6bf75ae04 Update profile search request to match updated fulltext index definition 2020-09-26 18:32:43 -04:00
Hypolite Petovan 4621ae2001 [Database v0008] Replace profile_url with username in profile full-text index
- Prevents search matches on node domain name
2020-09-26 18:32:21 -04:00
Michael Vogel 7780d3af09
Merge pull request #59 from MrPetovan/bug/38-unique-server-alias
Add unique key on server_alias.alias
2020-09-27 00:28:19 +02:00
Hypolite Petovan e873d62e2c Expand ON DUPLICATE KEY statement to match the new unique key 2020-09-26 18:09:21 -04:00
Hypolite Petovan 8e6aa14704 [Database v0007] Add unique key on server_alias.alias
- Fix inconsistent behaviors with aliases referring to multiple servers
2020-09-26 18:09:08 -04:00
Michael Vogel 751a45fd3c
Merge pull request #58 from MrPetovan/bug/47-drop-server-path-field
[Database v0006] Drop unused server.path field
2020-09-26 23:11:16 +02:00
Michael Vogel b48c436141
Merge pull request #57 from MrPetovan/bug/45-drop-key-validation
Remove validity check on profile key parameter
2020-09-26 23:07:49 +02:00
Hypolite Petovan ca0bb09f81 [Database v0006] Drop unused server.path field
- Fix "Field 'path' doesn't have a default value" errors
2020-09-26 17:06:40 -04:00
Hypolite Petovan c21642d705 Improve logging for invalid parameters during profile polling 2020-09-26 16:33:55 -04:00
Hypolite Petovan c8fa6ef3dc Remove validity check on profile key parameter 2020-09-26 16:33:29 -04:00
Hypolite Petovan ffa16d1935
Merge pull request #55 from realkinetix/server-max-health-fix
Fix $server_max_health value being overwritten while calculating
2020-09-13 22:26:42 -04:00
Adam Clark 69b2356a1b Fix $server_max_health value being overwritten while calculating 2020-09-13 23:12:48 +00:00
Michael Vogel 1ca13876fb
Merge pull request #52 from tobiasd/20200901-it
IT translation update THX Sylke Vicious
2020-09-01 15:11:23 +02:00
Tobias Diekershoff fad8939cb4 IT translation update THX Sylke Vicious 2020-09-01 15:02:27 +02:00
Hypolite Petovan 896a07f9cb
Merge pull request #51 from tobiasd/20200818-lng
EN GB and PL translation updates
2020-08-18 11:54:12 -04:00
Tobias Diekershoff 1451b18460 PL translation updated THX Waldis 2020-08-18 17:51:53 +02:00
Tobias Diekershoff d04b50d2b9 EN GB translation updated THX AndyH3 2020-08-18 17:51:27 +02:00
Hypolite Petovan c41ce95f4e
Merge pull request #50 from annando/user-agent
User agent added
2020-07-17 19:47:34 -04:00
Michael 776851b84f User agent added 2020-07-17 20:41:02 +00:00
Michael Vogel 937fedc2c7
Merge pull request #46 from MrPetovan/release/2.3.1
Release 2.3.1
2020-06-20 22:54:07 +02:00
Hypolite Petovan 0c203131b9 Increase specificity of checks of $param
- Avoids warnings and notices
2020-06-20 12:47:17 -04:00
Hypolite Petovan 7799fb99ed [Composer] Update dependency mrpetovan/Net_Ping to version 1.2 2020-06-20 12:45:18 -04:00
Hypolite Petovan b6933785dd [Composer] Update lock file hash 2020-06-17 15:16:39 -04:00
Tobias Diekershoff 83aa5152aa
Merge pull request #44 from MrPetovan/release/2.3.0
Release 2.3.0
2020-06-17 19:50:29 +02:00
Hypolite Petovan 9ee72bb382 Update container namespace after dependency replacement
- container-interop has been replaced with psr/container
2020-06-17 09:27:20 -04:00
Hypolite Petovan ad6db150c5 Update references to friendica/friendica-directory stable branch 2020-06-15 14:05:26 -04:00
Hypolite Petovan 30bdf306ba Bump version number for 2.3.0 release 2020-06-15 14:05:26 -04:00
Hypolite Petovan 5c9432dd57 [Composer] Replace abandoned leafo/scssphp with scssphp/scssphp 2020-06-15 14:05:21 -04:00
Hypolite Petovan 19631ef206 [Composer] Update dependencies
- Removing sebastian/resource-operations (1.0.0)
  - Removing sebastian/code-unit-reverse-lookup (1.0.1)
  - Removing myclabs/deep-copy (1.8.1)
  - Removing container-interop/container-interop (1.2.0)
  - Removing sebastian/object-enumerator (2.0.1)
  - Updating fxp/composer-asset-plugin (v1.4.4 => v1.4.6)
  - Updating atlas/pdo (1.1.1 => 1.1.2)
  - Updating boronczyk/localization-middleware (1.4 => 1.4.1)
  - Updating byjg/anydataset (4.0.0 => 4.0.1)
  - Updating byjg/anydataset-db (4.0.0 => 4.0.1)
  - Updating byjg/migration (4.0.2 => 4.0.3)
  - Updating gettext/languages (2.5.0 => 2.6.0)
  - Updating gettext/gettext (v4.6.2 => v4.8.2)
  - Updating masterminds/html5 (2.5.0 => 2.7.1)
  - Updating psr/log (1.1.0 => 1.1.3)
  - Updating monolog/monolog (1.24.0 => 1.25.4)
  - Downgrading sebastian/version (2.0.1 => 1.0.6)
  - Downgrading sebastian/recursion-context (2.0.0 => 1.0.5)
  - Downgrading sebastian/exporter (2.0.0 => 1.2.2)
  - Downgrading sebastian/environment (2.0.0 => 1.3.8)
  - Updating symfony/polyfill-ctype (v1.10.0 => v1.17.0)
  - Updating webmozart/assert (1.4.0 => 1.5.0)
  - Updating phpdocumentor/reflection-common (1.0.1 => 2.1.0)
  - Updating phpdocumentor/type-resolver (0.4.0 => 1.0.1)
  - Updating phpdocumentor/reflection-docblock (4.3.0 => 4.3.4)
  - Updating doctrine/instantiator (1.1.0 => 1.3.1)
  - Updating phpspec/prophecy (1.8.0 => v1.10.3)
  - Downgrading phpunit/phpunit-mock-objects (3.4.4 => 2.3.8)
  - Downgrading phpunit/php-token-stream (2.0.2 => 1.4.12)
  - Downgrading phpunit/php-code-coverage (4.0.8 => 2.2.4)
  - Downgrading phpunit/phpunit (5.7.27 => 4.8.36)
  - Updating sarahman/simple-filesystem-cache (1.0.0 => 1.0.1)
  - Updating slim/slim (3.12.0 => 3.12.3)
  - Updating slim/php-view (2.2.0 => 2.2.1)
  - Updating bower-asset/bootstrap.native (2.0.25 => 2.0.27)
  - Updating bower-asset/fontawesome (5.7.2 => 5.13.0)
  - Updating bower-asset/bootstrap (v4.3.1 => v4.5.0)
  - Updating leafo/scssphp (v0.7.7 => v0.7.8)
  - Updating pear/pear_exception (v1.0.0 => v1.0.1)
  - Updating composer/xdebug-handler (1.3.2 => 1.4.2)
  - Updating netresearch/jsonmapper (v1.4.0 => v1.6.0)
  - Updating felixfbecker/advanced-json-rpc (v3.0.3 => v3.1.1)
  - Updating felixfbecker/language-server-protocol (v1.2.0 => v1.4.0)
  - Updating nikic/php-parser (v4.2.1 => v4.5.0)
  - Updating sabre/event (5.0.3 => 5.1.0)
  - Updating sabre/uri (2.1.1 => 2.2.0)
2020-06-15 09:43:08 -04:00
Hypolite Petovan 685772e24e [Composer] Replace abandoned zendframefork/zend-escape with suggested laminas/laminas-escape 2020-06-15 09:43:07 -04:00
Hypolite Petovan deabe4da49 [Composer] Enforce minimum PHP version during composer update
- Downgrade symfony/yaml to version v3.4.42 to satisfy the enforced minimum PHP version
2020-06-15 09:43:07 -04:00
Michael Vogel d509dfbbfd
Merge pull request #43 from tobiasd/master
updated CS, DE, FR and added ar  ca  cs  de  en  en_GB  et  fr  it  ja  nl  pl  ru  th  zh_CN translation
2020-06-15 10:38:29 +02:00
Tobias Diekershoff aeb0a67b12 updated CS, DE, FR and added ar ca cs de en en_GB et fr it ja nl pl ru th zh_CN translation 2020-06-15 09:54:58 +02:00
Michael Vogel 2eca458ec1
Merge pull request #42 from MrPetovan/master
Use byjg/uri dependency instead of adding new URL-handling library
2020-06-14 21:31:21 +02:00
Hypolite Petovan b0a258cd0e Use byjg/uri dependency instead of adding new URL-handling library in PHPRenderer 2020-06-14 15:13:18 -04:00
Hypolite Petovan e082c0535d [Composer] Added core dependency byjg/uri 2020-06-14 15:13:17 -04:00
Michael Vogel b030cfd4e3
Merge pull request #41 from friendica/task/24-add-zrl-parameter-support
Add zrl parameter support
2020-06-14 09:37:05 +02:00
Hypolite Petovan 6cdbcbddb1 [translation] Update translation files after string update 2020-06-13 13:25:05 -04:00
Hypolite Petovan 476f7ae832 Add ZRL parameter support sitewide in templates 2020-06-13 13:21:18 -04:00
Hypolite Petovan 57dd610e73 Add u() and r() method to PhpRenderer
- Add Router dependency
2020-06-13 13:20:49 -04:00
Hypolite Petovan 0cdbd3af2d Add ZrlMiddleware to the stack 2020-06-13 13:17:40 -04:00
Hypolite Petovan 230ceeab29 Add names to routes we need to get URLs for 2020-06-13 13:17:19 -04:00
Hypolite Petovan f47f263fc3 Add ZrlMiddleware class 2020-06-13 13:16:35 -04:00
Hypolite Petovan a402fbdf5d Add Utils\Url class 2020-06-13 13:16:25 -04:00
Hypolite Petovan 10edbea99e Update author email address in file headers 2020-06-13 13:15:53 -04:00
Hypolite Petovan c18551c44c
Merge pull request #35 from AlfredSK/AlfredSK-change-queries-from-open-to-not-closed
Show and count also servers with policy 'approve'
2019-11-01 13:05:27 -04:00
Steffen K9 dfd1a14300
Change the statistics query as well 2019-11-01 17:18:15 +01:00
Steffen K9 778168e0c4
Show also servers with policy 'approve'
Changed the queries to show also servers with register policy 'approval'.
2019-11-01 17:15:26 +01:00
Hypolite Petovan 1e3dab7c10
Merge pull request #32 from tobiasd/20190930-lng
Updated translations of directory from Transifex sources
2019-10-01 07:58:30 -04:00
Tobias Diekershoff 8c602d3566 updated CS, DE, FR and added AR, en_GB, ET, IT, JA, NL, PL, TH, zh_CN translation 2019-09-30 20:38:28 +02:00
Tobias Diekershoff 2e1812a369 added language codes to the settings.php file 2019-09-30 20:35:41 +02:00
Hypolite Petovan a0cfd33521 Fix queries to work with sql_mode=only_full_group_by 2019-05-12 14:00:44 -04:00
137 changed files with 8137 additions and 1298 deletions

View File

@ -4,7 +4,7 @@
1. Fork the repository
2. Create a new branch for each feature or improvement
3. Send a pull request from each feature branch to the master branch
3. Send a pull request from each feature branch to the stable branch
It is very important to separate new features or improvements into separate feature branches, and to send a
pull request for each branch. This allows us to review and pull in new features or improvements individually.

View File

@ -1 +1 @@
2.2.1
2.4.2

BIN
bin/composer.phar Normal file

Binary file not shown.

View File

@ -15,9 +15,9 @@ require __DIR__ . '/../src/dependencies.php';
(new \Friendica\Directory\Controllers\Cron(
$container->get('atlas'),
$container->get('\Friendica\Directory\Pollers\Profile'),
$container->get('\Friendica\Directory\Pollers\Server'),
$container->get('\Friendica\Directory\Pollers\Directory'),
$container->get(\Friendica\Directory\Pollers\Profile::class),
$container->get(\Friendica\Directory\Pollers\Server::class),
$container->get(\Friendica\Directory\Pollers\Directory::class),
$container->get('logger')
))->execute();

View File

@ -16,21 +16,24 @@
"ext-curl": "*",
"ext-gd": "*",
"ext-json": "*",
"ext-pdo": "*",
"asika/simple-console": "^1.0",
"atlas/pdo": "^1.1",
"boronczyk/localization-middleware": "^1.4",
"byjg/migration": "^4.0",
"byjg/webrequest": "^1.0",
"byjg/uri": "^1.0.4",
"gettext/gettext": "^4.6",
"gofabian/negotiation-middleware": "^0.1.3",
"gofabian/negotiation-middleware": "dev-master",
"guzzlehttp/guzzle": "^6.5",
"laminas/laminas-escaper": "^2.6",
"laminas/laminas-zendframework-bridge": "^1.4",
"masterminds/html5": "^2.3",
"monolog/monolog": "^1.17",
"mrpetovan/net_ping": "^1.0",
"mrpetovan/net_ping": "^1.2",
"sarahman/simple-filesystem-cache": "^1.0",
"seld/cli-prompt": "^1.0",
"slim/slim": "^3.1",
"slim/php-view": "^2.0",
"zendframework/zend-escaper": "^2.6",
"fxp/composer-asset-plugin": "^1.4",
"bower-asset/bootstrap.native": "^2.0",
"bower-asset/fontawesome": "^5.5"
@ -38,8 +41,8 @@
"require-dev": {
"bower-asset/bootstrap": "^4.1",
"phpunit/phpunit": ">=4.8 < 6.0",
"vimeo/psalm": "^2.0",
"leafo/scssphp": "^0.7.7"
"scssphp/scssphp": "^1.1",
"vimeo/psalm": "^2.0"
},
"autoload": {
"psr-4": {
@ -52,6 +55,9 @@
}
},
"config": {
"platform": {
"php": "7.3.0"
},
"process-timeout" : 0,
"autoloader-suffix": "FriendicaDirectory",
"optimize-autoloader": true,

1971
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,16 @@ Redirects to the base URL of a random server with open registration policy and a
## Search
```
GET /search[/account_type]?q=...
GET /search[/account_type]?q=...[&page=...][&limit=...]
Accept: application/json
```
Parameters:
URI Parameter:
- `account_type` (optional): An arbitrary account type string. Expected values are `all`, `people`, `news`, `organization` and `group`. Default is `all`.
Query parameters:
- `q`: The search query.
- `account_type` (optional): An arbitrary account type string. Currently supported are `all`, `people` and `forum`. Default is `all`.
- `page` (optional): The page number, default is 1.
- `limit` (optional): The page size, default is 20, max is 100.
Returns a JSON structure containing a paginated list profiles matching the search query and the optional account type.
@ -42,10 +44,11 @@ Example:
"region": "New York",
"country": "USA",
"profile_url": "https://friendica.mrpetovan.com/profile/hypolite",
"dfrn_request": "https://friendica.mrpetovan.com/dfrn_request/hypolite",
"photo": "https://friendica.mrpetovan.com/photo/27330388315ae4ed2b03e3c116980490-4.jpg?ts=1541567135",
"tags": "videogame gaming boardgame politics philosophy development programming php",
"last_activity": "2018-45"
"last_activity": "2018-45",
"remote_follow": "https://friendica.mrpetovan.com/remote_follow/hypolite",
"subscribe": null
},
...
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -5,7 +5,7 @@ namespace Friendica\Directory\Content;
/**
* The Pager has two very different output, Minimal and Full, see renderMinimal() and renderFull() for more details.
*
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Pager
{

View File

@ -7,14 +7,10 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class MatchSearch
{
/**
* @var \Atlas\Pdo\Connection
*/
private $atlas;
/**
* @var \Friendica\Directory\Models\Profile
*/
@ -25,12 +21,10 @@ class MatchSearch
private $l10n;
public function __construct(
\Atlas\Pdo\Connection $atlas,
\Friendica\Directory\Models\Profile $profileModel,
\Gettext\TranslatorInterface $l10n
)
{
$this->atlas = $atlas;
$this->profileModel = $profileModel;
$this->l10n = $l10n;
}
@ -48,10 +42,18 @@ class MatchSearch
$pager->setPage(filter_input(INPUT_POST, 'p', FILTER_SANITIZE_NUMBER_INT));
$sql_where = "MATCH (p.`tags`) AGAINST (:query)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
$values = ['query' => $query];
$profiles = $this->profileModel->getListForDisplay($pager->getItemsPerPage(), $pager->getStart(), $sql_where, $values);
$profiles = $this->profileModel->getListForDisplay(
null,
$pager->getItemsPerPage(),
$pager->getStart(),
$sql_where,
$values,
);
$results = [];
foreach ($profiles as $profile) {

View File

@ -6,7 +6,7 @@ use Slim\Http\Request;
use Slim\Http\Response;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Photo
{
@ -14,12 +14,18 @@ class Photo
* @var \Atlas\Pdo\Connection
*/
private $atlas;
/**
* @var string
*/
private $defaultProfilePictureSmallPath;
public function __construct(
\Atlas\Pdo\Connection $atlas
\Atlas\Pdo\Connection $atlas,
string $defaultProfilePictureSmallPath
)
{
$this->atlas = $atlas;
$this->defaultProfilePictureSmallPath = $defaultProfilePictureSmallPath;
}
public function render(Request $request, Response $response, array $args): Response
@ -30,7 +36,7 @@ class Photo
);
if (!$data) {
$data = file_get_contents('public/images/default-profile-sm.jpg');
$data = file_get_contents($this->defaultProfilePictureSmallPath);
}
//Try and cache our result.

View File

@ -7,14 +7,10 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Search
{
/**
* @var \Atlas\Pdo\Connection
*/
private $atlas;
/**
* @var \Friendica\Directory\Models\Profile
*/
@ -25,19 +21,19 @@ class Search
private $l10n;
public function __construct(
\Atlas\Pdo\Connection $atlas,
\Friendica\Directory\Models\Profile $profileModel,
\Gettext\TranslatorInterface $l10n
)
{
$this->atlas = $atlas;
$this->profileModel = $profileModel;
$this->l10n = $l10n;
}
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
{
$pager = new Pager($this->l10n, $request, 20);
$limit = min(100, filter_input(INPUT_GET, 'limit', FILTER_SANITIZE_NUMBER_INT) ?: 20);
$pager = new Pager($this->l10n, $request, $limit);
$originalQuery = $query = filter_input(INPUT_GET, 'q');
@ -47,8 +43,10 @@ class Search
$query .= '%';
$sql_where = '`' . $field . '` LIKE :query';
} else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`profile_url`, p.`locality`, p.`region`, p.`country`, p.`tags` )
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
}
$values = ['query' => $query];
@ -60,7 +58,13 @@ AND `account_type` = :account_type';
$values['account_type'] = $account_type;
}
$profiles = $this->profileModel->getListForDisplay($pager->getItemsPerPage(), $pager->getStart(), $sql_where, $values);
$profiles = $this->profileModel->getListForDisplay(
null,
$pager->getItemsPerPage(),
$pager->getStart(),
$sql_where,
$values,
);
$count = $this->profileModel->getCountForDisplay($sql_where, $values);

View File

@ -6,7 +6,7 @@ use Slim\Http\Request;
use Slim\Http\Response;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Submit
{

View File

@ -7,7 +7,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Surprise
{

View File

@ -6,7 +6,7 @@ use Slim\Http\Request;
use Slim\Http\Response;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class SyncPull
{

View File

@ -7,7 +7,7 @@ use Monolog\Logger;
/**
* Description of Console
*
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Console extends \Asika\SimpleConsole\Console
{

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Console;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class DirectoryAdd extends \Asika\SimpleConsole\Console
{

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Console;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class DirectoryPoll extends \Asika\SimpleConsole\Console
{

View File

@ -6,7 +6,7 @@ use Gettext\Merge;
use Gettext\Translations;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ExtractStrings extends \Asika\SimpleConsole\Console
{

View File

@ -7,7 +7,7 @@ use Monolog\Logger;
use Seld\CliPrompt\CliPrompt;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Install extends \Asika\SimpleConsole\Console
{
@ -31,9 +31,9 @@ class Install extends \Asika\SimpleConsole\Console
protected function getHelp()
{
$help = <<<HELP
console install - Install directory
console install - Install wizard
Usage
bin/console install <server_url> [-h|--help|-?] [-v]
bin/console install [-h|--help|-?] [-v]
Description
Install directory

View File

@ -5,7 +5,7 @@ namespace Friendica\Directory\Controllers\Console;
use Friendica\Directory\Models\ProfilePollQueue;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ProfileAdd extends \Asika\SimpleConsole\Console
{

View File

@ -5,7 +5,7 @@ namespace Friendica\Directory\Controllers\Console;
use Friendica\Directory\Models\Profile;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ProfileHide extends \Asika\SimpleConsole\Console
{

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Console;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ProfilePoll extends \Asika\SimpleConsole\Console
{

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Console;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ServerHide extends \Asika\SimpleConsole\Console
{

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Console;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class ServerPoll extends \Asika\SimpleConsole\Console
{

View File

@ -5,7 +5,7 @@ namespace Friendica\Directory\Controllers\Console;
use Monolog\Logger;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class UpdateDb extends \Asika\SimpleConsole\Console
{
@ -37,12 +37,14 @@ class UpdateDb extends \Asika\SimpleConsole\Console
$help = <<<HELP
console updatedb - Update database schema
Usage
bin/console updatedb <server_url> [-h|--help|-?] [-v]
bin/console updatedb [<version>] [-h|--help|-?] [-v]
Description
Update database schema
Options
<version> Optional target version number, default is the latest version.
Do not use this parameter if you're not sure what you're doing, it will result in data loss!
-h|--help|-? Show help information
-v Show more debug information.
HELP;
@ -56,16 +58,38 @@ HELP;
return 0;
}
if (count($this->args) > 1) {
if (count($this->args) > 2) {
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
$this->out('Updating database schema to latest version...');
$currentVersion = $this->migration->getCurrentVersion()['version'];
$this->migration->up();
$this->out('Database schema currently in version ' . $currentVersion);
$this->out('Database schema migrated to version ' . $this->migration->getCurrentVersion()['version']);
if (count($this->args) == 1) {
$this->out('Updating database schema to latest version...');
$this->migration->up();
$this->out('Database schema migrated to version ' . $this->migration->getCurrentVersion()['version']);
return 0;
}
$target = $this->getArgument(1);
if ($target > $currentVersion) {
$this->out('Updating database schema to version ' . $target);
$this->migration->up($target);
$this->out('Database schema migrated up to version ' . $this->migration->getCurrentVersion()['version']);
return 0;
}
if ($target < $currentVersion) {
$this->out('Downgrading database schema to version ' . $target);
$this->migration->down($target);
$this->out('Database schema migrated down to version ' . $this->migration->getCurrentVersion()['version']);
return 0;
}
$this->out('Target version equal to current version, exiting.');
return 0;
}
}

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Cron
{

View File

@ -4,13 +4,13 @@ namespace Friendica\Directory\Controllers\Web;
use Friendica\Directory\Content\Pager;
use Friendica\Directory\Views\Widget\PopularCountries;
use Friendica\Directory\Views\Widget\PopularLanguages;
use Friendica\Directory\Views\Widget\PopularProfileLanguages;
use Friendica\Directory\Views\Widget\PopularTags;
use Slim\Http\Request;
use Slim\Http\Response;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Directory extends BaseController
{
@ -18,6 +18,10 @@ class Directory extends BaseController
* @var \Atlas\Pdo\Connection
*/
private $atlas;
/**
* @var \Friendica\Directory\Models\Server
*/
private $serverModel;
/**
* @var \Friendica\Directory\Models\Profile
*/
@ -37,6 +41,7 @@ class Directory extends BaseController
public function __construct(
\Atlas\Pdo\Connection $atlas,
\Friendica\Directory\Models\Server $serverModel,
\Friendica\Directory\Models\Profile $profileModel,
\Friendica\Directory\Views\Widget\AccountTypeTabs $accountTypeTabs,
\Friendica\Directory\Views\PhpRenderer $renderer,
@ -44,6 +49,7 @@ class Directory extends BaseController
)
{
$this->atlas = $atlas;
$this->serverModel = $serverModel;
$this->profileModel = $profileModel;
$this->accountTypeTabs = $accountTypeTabs;
$this->renderer = $renderer;
@ -54,20 +60,26 @@ class Directory extends BaseController
{
$popularTags = new PopularTags($this->atlas, $this->renderer);
$popularCountries = new PopularCountries($this->atlas, $this->renderer);
$popularLanguages = new PopularLanguages($this->atlas, $this->renderer);
$popularLanguages = new PopularProfileLanguages($this->atlas, $this->renderer);
$pager = new Pager($this->l10n, $request, 20);
$condition = '';
$sql_where = '';
$values = [];
if (!empty($args['account_type'])) {
$condition = '`account_type` = :account_type';
$sql_where = '`account_type` = :account_type';
$values = ['account_type' => $args['account_type']];
}
$profiles = $this->profileModel->getListForDisplay($pager->getItemsPerPage(), $pager->getStart(), $condition, $values);
$profiles = $this->profileModel->getListForDisplay(
$this->serverModel->getSubscribeUrlByProfile($request->getQueryParam('zrl', '')),
$pager->getItemsPerPage(),
$pager->getStart(),
$sql_where,
$values,
);
$count = $this->profileModel->getCountForDisplay($condition, $values);
$count = $this->profileModel->getCountForDisplay($sql_where, $values);
$vars = [
'title' => $this->l10n->gettext('People'),
@ -82,7 +94,6 @@ class Directory extends BaseController
$content = $this->renderer->fetch('directory.phtml', $vars);
// Render index view
return ['content' => $content];
}
}

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Web;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Page extends BaseController
{

View File

@ -5,7 +5,7 @@ namespace Friendica\Directory\Controllers\Web;
use \Friendica\Directory\Content\Pager;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Search extends BaseController
{
@ -13,6 +13,10 @@ class Search extends BaseController
* @var \Atlas\Pdo\Connection
*/
private $atlas;
/**
* @var \Friendica\Directory\Models\Server
*/
private $serverModel;
/**
* @var \Friendica\Directory\Models\Profile
*/
@ -32,6 +36,7 @@ class Search extends BaseController
public function __construct(
\Atlas\Pdo\Connection $atlas,
\Friendica\Directory\Models\Server $serverModel,
\Friendica\Directory\Models\Profile $profileModel,
\Friendica\Directory\Views\Widget\AccountTypeTabs $accountTypeTabs,
\Friendica\Directory\Views\PhpRenderer $renderer,
@ -39,6 +44,7 @@ class Search extends BaseController
)
{
$this->atlas = $atlas;
$this->serverModel = $serverModel;
$this->profileModel = $profileModel;
$this->accountTypeTabs = $accountTypeTabs;
$this->renderer = $renderer;
@ -47,7 +53,9 @@ class Search extends BaseController
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): array
{
$pager = new Pager($this->l10n, $request, 20);
$limit = min(100, filter_input(INPUT_GET, 'limit', FILTER_SANITIZE_NUMBER_INT) ?: 20);
$pager = new Pager($this->l10n, $request, $limit);
$originalQuery = $query = $request->getParam('q', '');
$field = $request->getParam('field', '');
@ -69,8 +77,10 @@ class Search extends BaseController
}
} else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`profile_url`, p.`locality`, p.`region`, p.`country`, p.`tags` )
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
}
$values = ['query' => $query];
@ -85,7 +95,13 @@ AND `account_type` = :account_type';
$values['account_type'] = $account_type;
}
$profiles = $this->profileModel->getListForDisplay($pager->getItemsPerPage(), $pager->getStart(), $sql_where, $values);
$profiles = $this->profileModel->getListForDisplay(
$this->serverModel->getSubscribeUrlByProfile($request->getQueryParam('zrl', '')),
$pager->getItemsPerPage(),
$pager->getStart(),
$sql_where,
$values,
);
$count = $this->profileModel->getCountForDisplay($sql_where, $values);
@ -102,7 +118,6 @@ AND `account_type` = :account_type';
$content = $this->renderer->fetch('search.phtml', $vars);
// Render index view
return ['content' => $content, 'noNavSearch' => true];
}
}

View File

@ -2,13 +2,14 @@
namespace Friendica\Directory\Controllers\Web;
use \Friendica\Directory\Content\Pager;
use Friendica\Directory\Content\Pager;
use Friendica\Directory\Views\Widget\PopularServerLanguages;
use PDO;
use Slim\Http\Request;
use Slim\Http\Response;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Servers extends BaseController
{
@ -46,7 +47,7 @@ class Servers extends BaseController
{
$stable_version = $this->simplecache->get('stable_version');
if (!$stable_version) {
$stable_version = trim(file_get_contents('https://git.friendi.ca/friendica/friendica/raw/branch/master/VERSION'));
$stable_version = trim(file_get_contents('https://git.friendi.ca/friendica/friendica/raw/branch/stable/VERSION'));
$this->simplecache->set('stable_version', $stable_version);
}
@ -58,19 +59,32 @@ class Servers extends BaseController
$rc_version = str_replace('-dev', '-rc', $dev_version);
$popularLanguages = new PopularServerLanguages($this->atlas, $this->renderer);
$pager = new Pager($this->l10n, $request, 20);
$sql_where = '';
$values = [];
if (!empty($args['language'])) {
$sql_where .= '
AND LEFT(`language`, 2) = LEFT(:language, 2)';
$values['language'] = $args['language'];
}
$stmt = 'SELECT *
FROM `server` s
WHERE `reg_policy` = "REGISTER_OPEN"
WHERE `reg_policy` != "REGISTER_CLOSED"
AND `available`
AND NOT `hidden`
' . $sql_where . '
ORDER BY `health_score` DESC, `ssl_state` DESC, `info` != "" DESC, `last_seen` DESC
LIMIT :start, :limit';
$servers = $this->atlas->fetchAll($stmt, [
$listValues = array_merge($values, [
'start' => [$pager->getStart(), PDO::PARAM_INT],
'limit' => [$pager->getItemsPerPage(), PDO::PARAM_INT]
]);
$servers = $this->atlas->fetchAll($stmt, $listValues);
foreach ($servers as $key => $server) {
$servers[$key]['user_count'] = $this->atlas->fetchValue(
@ -81,18 +95,22 @@ LIMIT :start, :limit';
$stmt = 'SELECT COUNT(*)
FROM `server` s
WHERE `reg_policy` = "REGISTER_OPEN"
WHERE `reg_policy` != "REGISTER_CLOSED"
AND `available`
AND NOT `hidden`';
$count = $this->atlas->fetchValue($stmt);
AND NOT `hidden`
' . $sql_where;
$count = $this->atlas->fetchValue($stmt, $values);
$vars = [
'title' => $this->l10n->gettext('Public Servers'),
'total' => $count,
'language' => $args['language'] ?? null,
'servers' => $servers,
'pager' => $pager->renderFull($count),
'stable_version' => $stable_version,
'rc_version' => $rc_version,
'dev_version' => $dev_version,
'popularLanguages' => $popularLanguages->render(),
];
$content = $this->renderer->fetch('servers.phtml', $vars);

View File

@ -3,7 +3,7 @@
namespace Friendica\Directory\Controllers\Web;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class Statistics extends BaseController
{
@ -49,13 +49,13 @@ class Statistics extends BaseController
AND `available`
AND NOT `hidden`
GROUP BY `language`
ORDER BY COUNT(*) DESC';