Browse Source

Merge pull request #6315 from MrPetovan/bug/6309-add-fulltext-index-profile

Rework mod/match and mod/msearch
pull/6333/head
Michael Vogel 3 years ago
committed by GitHub
parent
commit
94eca77041
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      bin/auth_ejabberd.php
  2. 2
      bin/console.php
  3. 3
      bin/daemon.php
  4. 2
      bin/worker.php
  5. 4
      boot.php
  6. 11
      composer.json
  7. 3
      composer.lock
  8. 3
      config/dbstructure.config.php
  9. 1
      include/api.php
  10. 3
      include/items.php
  11. 2
      include/text.php
  12. 6
      index.php
  13. 2
      mod/acl.php
  14. 4
      mod/admin.php
  15. 2
      mod/allfriends.php
  16. 2
      mod/attach.php
  17. 3
      mod/bookmarklet.php
  18. 2
      mod/common.php
  19. 2
      mod/community.php
  20. 3
      mod/dfrn_confirm.php
  21. 2
      mod/dfrn_notify.php
  22. 2
      mod/dfrn_poll.php
  23. 2
      mod/dfrn_request.php
  24. 2
      mod/display.php
  25. 2
      mod/events.php
  26. 4
      mod/feedtest.php
  27. 2
      mod/filer.php
  28. 5
      mod/item.php
  29. 2
      mod/like.php
  30. 4
      mod/lostpass.php
  31. 2
      mod/manage.php
  32. 166
      mod/match.php
  33. 2
      mod/message.php
  34. 73
      mod/msearch.php
  35. 3
      mod/network.php
  36. 2
      mod/nodeinfo.php
  37. 2
      mod/notes.php
  38. 2
      mod/parse_url.php
  39. 4
      mod/photos.php
  40. 2
      mod/phpinfo.php
  41. 2
      mod/ping.php
  42. 2
      mod/poke.php
  43. 3
      mod/profile.php
  44. 2
      mod/pubsub.php
  45. 2
      mod/register.php
  46. 2
      mod/regmod.php
  47. 2
      mod/removeme.php
  48. 2
      mod/salmon.php
  49. 1
      mod/search.php
  50. 2
      mod/subthread.php
  51. 2
      mod/tagger.php
  52. 4
      mod/videos.php
  53. 3
      src/App.php
  54. 2
      src/BaseObject.php
  55. 2
      src/Content/ForumManager.php
  56. 3
      src/Content/Nav.php
  57. 2
      src/Content/OEmbed.php
  58. 2
      src/Content/Pager.php
  59. 3
      src/Content/Widget.php
  60. 3
      src/Content/Widget/CalendarExport.php
  61. 2
      src/Content/Widget/TagCloud.php
  62. 2
      src/Core/Config.php
  63. 2
      src/Core/Config/JITConfigAdapter.php
  64. 2
      src/Core/Config/JITPConfigAdapter.php
  65. 2
      src/Core/Config/PreloadConfigAdapter.php
  66. 2
      src/Core/Config/PreloadPConfigAdapter.php
  67. 2
      src/Core/Console/AutomaticInstallation.php
  68. 3
      src/Core/Console/DatabaseStructure.php
  69. 2
      src/Core/Console/GlobalCommunitySilence.php
  70. 3
      src/Core/Console/Maintenance.php
  71. 1
      src/Core/Installer.php
  72. 3
      src/Core/L10n.php
  73. 2
      src/Core/NotificationsManager.php
  74. 2
      src/Core/PConfig.php
  75. 3
      src/Core/Session/CacheSessionHandler.php
  76. 4
      src/Core/Session/DatabaseSessionHandler.php
  77. 2
      src/Core/Theme.php
  78. 2
      src/Core/UserImport.php
  79. 2
      src/Core/Worker.php
  80. 2
      src/Database/DBA.php
  81. 641
      src/Database/DBStructure.php
  82. 2
      src/Database/PostUpdate.php
  83. 2
      src/Model/APContact.php
  84. 6
      src/Model/Contact.php
  85. 2
      src/Model/Conversation.php
  86. 4
      src/Model/Event.php
  87. 2
      src/Model/GContact.php
  88. 4
      src/Model/Group.php
  89. 4
      src/Model/Item.php
  90. 4
      src/Model/ItemContent.php
  91. 2
      src/Model/ItemURI.php
  92. 2
      src/Model/Mail.php
  93. 2
      src/Model/PermissionSet.php
  94. 2
      src/Model/Photo.php
  95. 2
      src/Model/Process.php
  96. 2
      src/Model/Profile.php
  97. 2
      src/Model/PushSubscriber.php
  98. 2
      src/Model/Queue.php
  99. 4
      src/Model/Term.php
  100. 4
      src/Model/User.php

3
bin/auth_ejabberd.php

@ -49,8 +49,7 @@ $directory = realpath($directory . DIRECTORY_SEPARATOR . "..");
chdir($directory);
require_once "boot.php";
require_once "include/dba.php";
require dirname(__DIR__) . '/vendor/autoload.php';
$a = new App(dirname(__DIR__));

2
bin/console.php

@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
include_once dirname(__DIR__) . '/boot.php';
require dirname(__DIR__) . '/vendor/autoload.php';
$a = new Friendica\App(dirname(__DIR__));
\Friendica\BaseObject::setApp($a);

3
bin/daemon.php

@ -30,8 +30,7 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
chdir($directory);
}
require_once "boot.php";
require_once "include/dba.php";
require dirname(__DIR__) . '/vendor/autoload.php';
$a = new App(dirname(__DIR__));

2
bin/worker.php

@ -26,7 +26,7 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
chdir($directory);
}
require_once "boot.php";
require dirname(__DIR__) . '/vendor/autoload.php';
$a = new App(dirname(__DIR__));

4
boot.php

@ -17,8 +17,6 @@
* easily as email does today.
*/
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
use Friendica\App;
use Friendica\BaseObject;
use Friendica\Core\Addon;
@ -35,8 +33,6 @@ use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Util\DateTimeFormat;
require_once 'include/text.php';
define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
define('FRIENDICA_VERSION', '2018.12-rc');

11
composer.json

@ -14,6 +14,7 @@
},
"require": {
"php": ">=5.6.1",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*",
@ -55,7 +56,15 @@
},
"psr-0": {
"": "library/"
}
},
"files": [
"include/conversation.php",
"include/dba.php",
"include/enotify.php",
"include/items.php",
"include/text.php",
"boot.php"
]
},
"config": {
"autoloader-suffix": "Friendica",

3
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "11efc727fd6cae00c1230616e31ad2a2",
"content-hash": "9e0c66963fa451c1c317569c89c1b278",
"packages": [
{
"name": "asika/simple-console",
@ -3563,6 +3563,7 @@
"prefer-lowest": false,
"platform": {
"php": ">=5.6.1",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*"

3
config/dbstructure.config.php

@ -34,7 +34,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1291);
define('DB_UPDATE_VERSION', 1292);
}
return [
@ -1059,6 +1059,7 @@ return [
"indexes" => [
"PRIMARY" => ["id"],
"uid_is-default" => ["uid", "is-default"],
"pub_keywords" => ["FULLTEXT", "pub_keywords"],
]
],
"profile_check" => [

1
include/api.php

@ -46,7 +46,6 @@ use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/conversation.php';
require_once 'mod/share.php';
require_once 'mod/item.php';
require_once 'mod/wall_upload.php';

3
include/items.php

@ -24,10 +24,7 @@ use Friendica\Util\ParseUrl;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
require_once 'include/text.php';
require_once 'mod/share.php';
require_once 'include/enotify.php';
function add_page_info_data(array $data, $no_photos = false)
{
Addon::callHooks('page_info_data', $data);

2
include/text.php

@ -30,8 +30,6 @@ use Friendica\Util\Strings;
use Friendica\Util\XML;
use Friendica\Content\Text\HTML;
require_once "include/conversation.php";
/**
* Turn user/group ACLs stored as angle bracketed text into arrays
*

6
index.php

@ -4,12 +4,10 @@
* Friendica
*/
use Friendica\App;
require_once 'boot.php';
require dirname(__DIR__) . '/vendor/autoload.php';
// We assume that the index.php is called by a frontend process
// The value is set to "true" by default in App
$a = new App(__DIR__, false);
$a = new Friendica\App(__DIR__, false);
$a->runFrontend();

2
mod/acl.php

@ -14,8 +14,6 @@ use Friendica\Model\Item;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
require_once 'include/dba.php';
function acl_content(App $a)
{
if (!local_user()) {

4
mod/admin.php

@ -33,10 +33,6 @@ use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
require_once 'include/enotify.php';
require_once 'include/text.php';
require_once 'include/items.php';
/**
* @brief Process send data from the admin panels subpages
*

2
mod/allfriends.php

@ -15,8 +15,6 @@ use Friendica\Module;
use Friendica\Util\Proxy as ProxyUtils;
require_once 'include/dba.php';
function allfriends_content(App $a)
{
$o = '';

2
mod/attach.php

@ -8,8 +8,6 @@ use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Util\Security;
require_once 'include/dba.php';
function attach_init(App $a)
{
if ($a->argc != 2) {

3
mod/bookmarklet.php

@ -11,9 +11,6 @@ use Friendica\Core\System;
use Friendica\Module\Login;
use Friendica\Util\Strings;
require_once 'include/conversation.php';
require_once 'include/items.php';
function bookmarklet_init()
{
$_GET["mode"] = "minimal";

2
mod/common.php

@ -14,8 +14,6 @@ use Friendica\Module;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
require_once 'include/dba.php';
function common_content(App $a)
{
$o = '';

2
mod/community.php

@ -93,8 +93,6 @@ function community_content(App $a, $update = 0)
}
}
require_once 'include/conversation.php';
if (!$update) {
$tabs = [];

3
mod/dfrn_confirm.php

@ -36,9 +36,6 @@ use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/enotify.php';
require_once 'include/items.php';
function dfrn_confirm_post(App $a, $handsfree = null)
{
$node = null;

2
mod/dfrn_notify.php

@ -16,8 +16,6 @@ use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Strings;
require_once 'include/items.php';
function dfrn_notify_post(App $a) {
Logger::log(__function__, Logger::TRACE);

2
mod/dfrn_poll.php

@ -17,8 +17,6 @@ use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
function dfrn_poll_init(App $a)
{
Login::sessionAuth();

2
mod/dfrn_request.php

@ -30,8 +30,6 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
require_once 'include/enotify.php';
function dfrn_request_init(App $a)
{
if ($a->argc > 1) {

2
mod/display.php

@ -214,8 +214,6 @@ function display_content(App $a, $update = false, $update_uid = 0)
return;
}
require_once 'include/conversation.php';
$o = '';
if ($update) {

2
mod/events.php

@ -22,8 +22,6 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
require_once 'include/items.php';
function events_init(App $a)
{
if (!local_user()) {

4
mod/feedtest.php

@ -12,10 +12,6 @@ use Friendica\Model\Contact;
use Friendica\Protocol\Feed;
use Friendica\Util\Network;
require_once 'boot.php';
require_once 'include/dba.php';
require_once 'include/text.php';
function feedtest_content(App $a)
{
if (!local_user()) {

2
mod/filer.php

@ -10,8 +10,6 @@ use Friendica\Core\Renderer;
use Friendica\Model\FileTag;
use Friendica\Util\XML;
require_once 'include/items.php';
function filer_content(App $a)
{
if (! local_user()) {

5
mod/item.php

@ -38,10 +38,6 @@ use Friendica\Util\Emailer;
use Friendica\Util\Security;
use Friendica\Util\Strings;
require_once 'include/enotify.php';
require_once 'include/text.php';
require_once 'include/items.php';
function item_post(App $a) {
if (!local_user() && !remote_user()) {
return 0;
@ -668,7 +664,6 @@ function item_post(App $a) {
// preview mode - prepare the body for display and send it via json
if ($preview) {
require_once 'include/conversation.php';
// We set the datarray ID to -1 because in preview mode the dataray
// doesn't have an ID.
$datarray["id"] = -1;

2
mod/like.php

@ -5,8 +5,6 @@ use Friendica\Core\System;
use Friendica\Model\Item;
use Friendica\Util\Strings;
require_once 'include/items.php';
function like_content(App $a) {
if (!local_user() && !remote_user()) {
return false;

4
mod/lostpass.php

@ -13,10 +13,6 @@ use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
require_once 'boot.php';
require_once 'include/enotify.php';
require_once 'include/text.php';
function lostpass_post(App $a)
{
$loginame = Strings::escapeTags(trim($_POST['login-name']));

2
mod/manage.php

@ -10,8 +10,6 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
require_once "include/text.php";
function manage_post(App $a) {
if (! local_user()) {

166
mod/match.php

@ -12,11 +12,9 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
require_once 'include/text.php';
/**
* @brief Controller for /match.
@ -26,13 +24,12 @@ require_once 'include/text.php';
*
* @param App $a App
*
* @return void|string
* @return string
*/
function match_content(App $a)
{
$o = '';
if (! local_user()) {
return;
if (!local_user()) {
return '';
}
$a->page['aside'] .= Widget::findPeople();
@ -40,91 +37,102 @@ function match_content(App $a)
$_SESSION['return_path'] = $a->cmd;
$r = q(
"SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
if (! DBA::isResult($r)) {
return;
$profile = Profile::getByUID(local_user());
if (!DBA::isResult($profile)) {
return '';
}
if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
notice(L10n::t('No keywords to match. Please add keywords to your default profile.') . EOL);
return;
return '';
}
$params = [];
$tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
$tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']);
if ($tags) {
$pager = new Pager($a->query_string);
$params['s'] = $tags;
$params['n'] = 100;
$params['s'] = $tags;
if ($pager->getPage() != 1) {
$params['p'] = $pager->getPage();
}
if (strlen(Config::get('system', 'directory'))) {
$host = get_server();
} else {
$host = System::baseUrl();
}
if (strlen(Config::get('system', 'directory'))) {
$x = Network::post(get_server().'/msearch', $params)->getBody();
} else {
$x = Network::post(System::baseUrl() . '/msearch', $params)->getBody();
}
$msearch_json = Network::post($host . '/msearch', $params)->getBody();
$j = json_decode($x);
if (count($j->results)) {
$pager->setItemsPerPage($j->items_page);
$id = 0;
foreach ($j->results as $jj) {
$match_nurl = Strings::normaliseLink($jj->url);
$match = q(
"SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
intval(local_user()),
DBA::escape($match_nurl)
);
if (!count($match)) {
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
$connlnk = System::baseUrl() . '/follow/?url=' . $jj->url;
$photo_menu = [
'profile' => [L10n::t("View Profile"), Contact::magicLink($jj->url)],
'follow' => [L10n::t("Connect/Follow"), $connlnk]
];
$contact_details = Contact::getDetailsByURL($jj->url, local_user());
$entry = [
'url' => Contact::magicLink($jj->url),
'itemurl' => defaults($contact_details, 'addr', $jj->url),
'name' => $jj->name,
'details' => defaults($contact_details, 'location', ''),
'tags' => defaults($contact_details, 'keywords', ''),
'about' => defaults($contact_details, 'about', ''),
'account_type' => Contact::getAccountType($contact_details),
'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
'inttxt' => ' ' . L10n::t('is interested in:'),
'conntxt' => L10n::t('Connect'),
'connlnk' => $connlnk,
'img_hover' => $jj->tags,
'photo_menu' => $photo_menu,
'id' => ++$id,
];
$entries[] = $entry;
}
}
$msearch = json_decode($msearch_json);
$start = defaults($_GET, 'start', 0);
$entries = [];
$paginate = '';
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
if (!empty($msearch->results)) {
for ($i = $start;count($entries) < 10 && $i < $msearch->total; $i++) {
$profile = $msearch->results[$i];
$o .= Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Profile Match'),
'$contacts' => $entries,
'$paginate' => $pager->renderFull($j->total)
]);
} else {
info(L10n::t('No matches') . EOL);
// Already known contact
if (Contact::getIdForURL($profile->url, local_user(), true)) {
continue;
}
// Workaround for wrong directory photo URL
$profile->photo = str_replace('http:///photo/', get_server() . '/photo/', $profile->photo);
$connlnk = System::baseUrl() . '/follow/?url=' . $profile->url;
$photo_menu = [
'profile' => [L10n::t("View Profile"), Contact::magicLink($profile->url)],
'follow' => [L10n::t("Connect/Follow"), $connlnk]
];
$contact_details = Contact::getDetailsByURL($profile->url, 0);
$entry = [
'url' => Contact::magicLink($profile->url),
'itemurl' => defaults($contact_details, 'addr', $profile->url),
'name' => $profile->name,
'details' => defaults($contact_details, 'location', ''),
'tags' => defaults($contact_details, 'keywords', ''),
'about' => defaults($contact_details, 'about', ''),
'account_type' => Contact::getAccountType($contact_details),
'thumb' => ProxyUtils::proxifyUrl($profile->photo, false, ProxyUtils::SIZE_THUMB),
'conntxt' => L10n::t('Connect'),
'connlnk' => $connlnk,
'img_hover' => $profile->tags,
'photo_menu' => $photo_menu,
'id' => $i,
];
$entries[] = $entry;
}
$data = [
'class' => 'pager',
'first' => [
'url' => 'match',
'text' => L10n::t('first'),
'class' => 'previous' . ($start == 0 ? 'disabled' : '')
],
'next' => [
'url' => 'match?start=' . $i,
'text' => L10n::t('next'),
'class' => 'next' . ($i >= $msearch->total ? ' disabled' : '')
]
];
$tpl = Renderer::getMarkupTemplate('paginate.tpl');
$paginate = Renderer::replaceMacros($tpl, ['pager' => $data]);
}
if (empty($entries)) {
info(L10n::t('No matches') . EOL);
}
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
$o = Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Profile Match'),
'$contacts' => $entries,
'$paginate' => $paginate
]);
return $o;
}

2
mod/message.php

@ -21,8 +21,6 @@ use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
require_once 'include/conversation.php';
function message_init(App $a)
{
$tabs = '';

73
mod/msearch.php

@ -4,45 +4,64 @@ use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBA;
function msearch_post(App $a) {
function msearch_post(App $a)
{
$search = defaults($_POST, 's', '');
$perpage = intval(defaults($_POST, 'n', 80));
$page = intval(defaults($_POST, 'p', 1));
$startrec = ($page - 1) * $perpage;
$perpage = (($_POST['n']) ? $_POST['n'] : 80);
$page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;
$total = 0;
$results = [];
$search = $_POST['s'];
if(! strlen($search))
killme();
if (!strlen($search)) {
$output = ['total' => 0, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
echo json_encode($output);
exit();
}
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
DBA::escape($search)
$count_stmt = DBA::p(
"SELECT COUNT(*) AS `total`
FROM `profile`
JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1
AND `user`.`hidewall` = 0
AND MATCH(`pub_keywords`) AGAINST (?)",
$search
);
if (DBA::isResult($r))
$total = $r[0]['total'];
if (DBA::isResult($count_stmt)) {
$row = DBA::fetch($count_stmt);
$total = $row['total'];
}
$results = [];
DBA::close($count_stmt);
$r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
DBA::escape($search),
intval($startrec),
intval($perpage)
$search_stmt = DBA::p(
"SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid`
FROM `user`
JOIN `profile` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1
AND `user`.`hidewall` = 0
AND MATCH(`pub_keywords`) AGAINST (?)
LIMIT ?, ?",
$search,
$startrec,
$perpage
);
if (DBA::isResult($r)) {
foreach($r as $rr)
$results[] = [
'name' => $rr['name'],
'url' => System::baseUrl() . '/profile/' . $rr['nickname'],
'photo' => System::baseUrl() . '/photo/avatar/' . $rr['uid'] . '.jpg',
'tags' => str_replace([',',' '],[' ',' '],$rr['pub_keywords'])
];
while($search_result = DBA::fetch($search_stmt)) {
$results[] = [
'name' => $search_result['name'],
'url' => System::baseUrl() . '/profile/' . $search_result['nickname'],
'photo' => System::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg',
'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords'])
];
}
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page + 1, 'results' => $results];
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
echo json_encode($output);
killme();
exit();
}

3
mod/network.php

@ -30,9 +30,6 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
require_once 'include/conversation.php';
require_once 'include/items.php';
function network_init(App $a)
{
if (!local_user()) {

2
mod/nodeinfo.php

@ -12,8 +12,6 @@ use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\Network;
require_once 'include/dba.php';
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
'href' => System::baseUrl().'/nodeinfo/1.0']]];

2
mod/notes.php

@ -34,8 +34,6 @@ function notes_content(App $a, $update = false)
return;
}
require_once 'include/conversation.php';
$o = Profile::getTabs($a, true);
if (!$update) {

2
mod/parse_url.php

@ -15,8 +15,6 @@ use Friendica\Core\Logger;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
require_once 'include/items.php';
function parse_url_content(App $a)
{
$text = null;

4
mod/photos.php

@ -34,8 +34,6 @@ use Friendica\Util\Temporal;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
function photos_init(App $a) {
if ($a->argc > 1) {
@ -946,8 +944,6 @@ function photos_content(App $a)
return;
}
require_once 'include/conversation.php';
if (empty($a->data['user'])) {
notice(L10n::t('No photos selected') . EOL);
return;

2
mod/phpinfo.php

@ -3,8 +3,6 @@
* @file mod/phpinfo.php
*/
require_once 'boot.php';
function phpinfo_content()
{
if (!is_site_admin()) {

2
mod/ping.php

@ -22,8 +22,6 @@ use Friendica\Util\Temporal;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\XML;
require_once 'include/enotify.php';
/**
* @brief Outputs the counts and the lists of various notifications
*

2
mod/poke.php

@ -25,8 +25,6 @@ use Friendica\Model\Item;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
function poke_init(App $a)
{
if (!local_user()) {

3
mod/profile.php

@ -127,9 +127,6 @@ function profile_content(App $a, $update = 0)
return Login::form();
}
require_once 'include/conversation.php';
require_once 'include/items.php';
$groups = [];
$remote_cid = null;

2
mod/pubsub.php

@ -9,8 +9,6 @@ use Friendica\Protocol\OStatus;
use Friendica\Util\Strings;
use Friendica\Core\System;
require_once 'include/items.php';
function hub_return($valid, $body)
{
if ($valid) {

2
mod/register.php

@ -18,8 +18,6 @@ use Friendica\Model;
use Friendica\Module\Tos;
use Friendica\Util\Strings;
require_once 'include/enotify.php';
function register_post(App $a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');

2
mod/regmod.php

@ -13,8 +13,6 @@ use Friendica\Model\Register;
use Friendica\Model\User;
use Friendica\Module\Login;
require_once 'include/enotify.php';
function user_allow($hash)
{
$a = get_app();

2
mod/removeme.php

@ -12,8 +12,6 @@ use Friendica\Database\DBA;
use Friendica\Model\User;
use Friendica\Util\Strings;
require_once 'include/enotify.php';
function removeme_post(App $a)
{
if (!local_user()) {

2
mod/salmon.php

@ -14,8 +14,6 @@ use Friendica\Protocol\Salmon;
use Friendica\Util\Crypto;
use Friendica\Util\Strings;
require_once 'include/items.php';
function salmon_post(App $a, $xml = '') {
if (empty($xml)) {

1
mod/search.php

@ -18,7 +18,6 @@ use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Util\Strings;
require_once 'include/conversation.php';
require_once 'mod/dirfind.php';
function search_saved_searches() {

2
mod/subthread.php

@ -13,8 +13,6 @@ use Friendica\Util\Security;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
function subthread_content(App $a) {
if (!local_user() && !remote_user()) {

2
mod/tagger.php

@ -13,8 +13,6 @@ use Friendica\Model\Item;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'include/items.php';
function tagger_content(App $a) {
if (!local_user() && !remote_user()) {

4
mod/videos.php

@ -18,8 +18,6 @@ use Friendica\Model\Profile;
use Friendica\Protocol\DFRN;
use Friendica\Util\Security;
require_once 'include/items.php';
function videos_init(App $a)
{
if ($a->argc > 1) {
@ -195,8 +193,6 @@ function videos_content(App $a)
return;
}
require_once 'include/conversation.php';
if (empty($a->data['user'])) {
notice(L10n::t('No videos selected') . EOL );
return;

3
src/App.php

@ -11,9 +11,6 @@ use Exception;
use Friendica\Database\DBA;
use Friendica\Network\HTTPException\InternalServerErrorException;
require_once 'boot.php';
require_once 'include/text.php';
/**
*
* class: App

2
src/BaseObject.php

@ -4,8 +4,6 @@
*/
namespace Friendica;
require_once 'boot.php';
/**
* Basic object
*

2
src/Content/ForumManager.php

@ -15,8 +15,6 @@ use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Util\Proxy as ProxyUtils;
require_once 'include/dba.php';
/**
* @brief This class handles methods related to the forum functionality
*/

3
src/Content/Nav.php

@ -15,9 +15,6 @@ use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
require_once 'boot.php';
require_once 'include/text.php';
class Nav
{
private static $selected = [

2
src/Content/OEmbed.php

@ -23,8 +23,6 @@ use Friendica\Util\ParseUrl;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
require_once 'include/dba.php';
/**
* Handles all OEmbed content fetching and replacement
*

2
src/Content/Pager.php

@ -169,7 +169,7 @@ class Pager
'next' => [
'url' => $this->ensureQueryParameter($this->baseQueryString . '&page=' . ($this->getPage() + 1)),
'text' => L10n::t('older'),
'class' => 'next' . ($displayedItemCount <= 0 ? ' disabled' : '')
'class' => 'next' . ($displayedItemCount < $this->getItemsPerPage() ? ' disabled' : '')
]
];

3
src/Content/Widget.php

@ -21,9 +21,6 @@ use Friendica\Model\Profile;
use Friendica\Util\Strings;
use Friendica\Util\XML;
require_once 'boot.php';
require_once 'include/dba.php';
class Widget
{
/**

3
src/Content/Widget/CalendarExport.php

@ -10,9 +10,6 @@ use Friendica\Content\Feature;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
require_once 'boot.php';
require_once 'include/text.php';
/**
* TagCloud widget
*

2
src/Content/Widget/TagCloud.php

@ -13,8 +13,6 @@ use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Util\Security;
require_once 'include/dba.php';
/**
* TagCloud widget
*

2
src/Core/Config.php

@ -12,8 +12,6 @@ use Friendica\App;
use Friendica\BaseObject;
use Friendica\Core\Config;
require_once 'include/dba.php';
/**
* @brief Arbitrary system configuration storage
*

2
src/Core/Config/JITConfigAdapter.php

@ -4,8 +4,6 @@ namespace Friendica\Core\Config;
use Friendica\BaseObject;
use Friendica\Database\DBA;
require_once 'include/dba.php';
/**
* JustInTime Configuration Adapter
*

2
src/Core/Config/JITPConfigAdapter.php

@ -4,8 +4,6 @@ namespace Friendica\Core\Config;
use Friendica\BaseObject;
use Friendica\Database\DBA;
require_once 'include/dba.php';
/**
* JustInTime User Configuration Adapter
*

2
src/Core/Config/PreloadConfigAdapter.php

@ -6,8 +6,6 @@ use Exception;
use Friendica\BaseObject;
use Friendica\Database\DBA;
require_once 'include/dba.php';
/**
* Preload Configuration Adapter
*

2
src/Core/Config/PreloadPConfigAdapter.php

@ -6,8 +6,6 @@ use Exception;
use Friendica\BaseObject;
use Friendica\Database\DBA;
require_once 'include/dba.php';
/**
* Preload User Configuration Adapter
*

2
src/Core/Console/AutomaticInstallation.php

@ -11,8 +11,6 @@ use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use RuntimeException;
require_once 'include/dba.php';
class AutomaticInstallation extends Console
{
protected function getHelp()

3
src/Core/Console/DatabaseStructure.php

@ -8,9 +8,6 @@ use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use RuntimeException;
require_once 'boot.php';
require_once 'include/dba.php';
/**
* @brief Performs database updates from the command line
*

2
src/Core/Console/GlobalCommunitySilence.php

@ -8,8 +8,6 @@ use Friendica\Network\Probe;
use Friendica\Util\Strings;
use RuntimeException;
require_once 'include/text.php';
/**
* @brief tool to silence accounts on the global community page
*

3
src/Core/Console/Maintenance.php

@ -4,9 +4,6 @@ namespace Friendica\Core\Console;
use Friendica\Core;
require_once 'boot.php';
require_once 'include/dba.php';
/**
* @brief Sets maintenance mode for this node
*

1
src/Core/Installer.php

@ -585,7 +585,6 @@ class Installer
*/
public function checkDB($dbhost, $dbuser, $dbpass, $dbdata)
{
require_once 'include/dba.php';
if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
$this->addCheck(L10n::t('Could not connect to database.'), false, true, '');

3
src/Core/L10n.php

@ -10,9 +10,6 @@ use Friendica\Core\Addon;
use Friendica\Core\Logger;
use Friendica\Core\System;
require_once 'boot.php';
require_once 'include/dba.php';
/**
* Provide Language, Translation, and Localization functions to the application
* Localization can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").

2
src/Core/NotificationsManager.php

@ -19,8 +19,6 @@ use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Temporal;
use Friendica\Util\XML;
require_once 'include/dba.php';
/**
* @brief Methods for read and write notifications from/to database
* or for formatting notifications

2
src/Core/PConfig.php

@ -11,8 +11,6 @@ namespace Friendica\Core;
use Friendica\App;
use Friendica\BaseObject;
require_once 'include/dba.php';
/**
* @brief Management of user configuration storage
* Note:

3
src/Core/Session/CacheSessionHandler.php

@ -8,9 +8,6 @@ use Friendica\Core\Logger;
use Friendica\Core\Session;
use SessionHandlerInterface;
require_once 'boot.php';
require_once 'include/text.php';
/**
* SessionHandler using Friendica Cache
*

4
src/Core/Session/DatabaseSessionHandler.php

@ -8,10 +8,6 @@ use Friendica\Core\Session;
use Friendica\Database\DBA;
use SessionHandlerInterface;
require_once 'boot.php';
require_once 'include/dba.php';
require_once 'include/text.php';
/**
* SessionHandler using database
*

2
src/Core/Theme.php

@ -9,8 +9,6 @@ namespace Friendica\Core;
use Friendica\Core\Logger;
use Friendica\Core\System;
require_once 'boot.php';
/**
* Some functions to handle themes
*/

2
src/Core/UserImport.php

@ -13,8 +13,6 @@ use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Strings;
require_once "include/dba.php";
/**
* @brief UserImport class
*/

2
src/Core/Worker.php

@ -11,8 +11,6 @@ use Friendica\Model\Process;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
require_once 'include/dba.php';
/**
* @file src/Core/Worker.php
*

2
src/Database/DBA.php

@ -16,8 +16,6 @@ use PDO;
use PDOException;
use PDOStatement;
require_once 'include/dba.php';
/**
* @class MySQL database class
*

641
src/Database/DBStructure.php

@ -2,6 +2,7 @@