Merge remote-tracking branch 'upstream/develop' into item-notification

This commit is contained in:
Michael 2020-01-05 07:47:55 +00:00
commit 6ac37e284d
12 changed files with 27 additions and 24 deletions

View file

@ -446,17 +446,6 @@ function curPageURL()
return $pageURL; return $pageURL;
} }
function get_server()
{
$server = Config::get("system", "directory");
if ($server == "") {
$server = "https://dir.friendica.social";
}
return $server;
}
function get_temppath() function get_temppath()
{ {
$temppath = Config::get("system", "temppath"); $temppath = Config::get("system", "temppath");

View file

@ -18,6 +18,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -634,7 +635,7 @@ function dfrn_request_content(App $a)
$page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:"); $page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:");
$invite_desc = L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.', get_server() . '/servers'); $invite_desc = L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.', Search::getGlobalDirectory() . '/servers');
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$header' => L10n::t('Friend/Connection Request'), '$header' => L10n::t('Friend/Connection Request'),

View file

@ -8,6 +8,7 @@ use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -56,7 +57,7 @@ function match_content(App $a)
$params['n'] = 100; $params['n'] = 100;
if (strlen(Config::get('system', 'directory'))) { if (strlen(Config::get('system', 'directory'))) {
$host = get_server(); $host = Search::getGlobalDirectory();
} else { } else {
$host = DI::baseUrl(); $host = DI::baseUrl();
} }
@ -79,7 +80,7 @@ function match_content(App $a)
} }
// Workaround for wrong directory photo URL // Workaround for wrong directory photo URL
$profile->photo = str_replace('http:///photo/', get_server() . '/photo/', $profile->photo); $profile->photo = str_replace('http:///photo/', Search::getGlobalDirectory() . '/photo/', $profile->photo);
$connlnk = DI::baseUrl() . '/follow/?url=' . $profile->url; $connlnk = DI::baseUrl() . '/follow/?url=' . $profile->url;
$photo_menu = [ $photo_menu = [

View file

@ -272,7 +272,7 @@ class Search
$return = GContact::searchByName($search, $mode); $return = GContact::searchByName($search, $mode);
} else { } else {
$p = $page > 1 ? 'p=' . $page : ''; $p = $page > 1 ? 'p=' . $page : '';
$curlResult = Network::curl(get_server() . '/search/people?' . $p . '&q=' . urlencode($search), false, ['accept_content' => 'application/json']); $curlResult = Network::curl(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), false, ['accept_content' => 'application/json']);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$searchResult = json_decode($curlResult->getBody(), true); $searchResult = json_decode($curlResult->getBody(), true);
if (!empty($searchResult['profiles'])) { if (!empty($searchResult['profiles'])) {
@ -283,4 +283,14 @@ class Search
return $return ?? []; return $return ?? [];
} }
/**
* Returns the global directory name, used in this node
*
* @return string
*/
public static function getGlobalDirectory()
{
return Config::get('system', 'directory', self::DEFAULT_DIRECTORY);
}
} }

View file

@ -289,7 +289,6 @@ class System
function notice($s) function notice($s)
function info($s) function info($s)
function is_site_admin() function is_site_admin()
function get_server()
function get_temppath() function get_temppath()
function get_cachefile($file, $writemode = true) function get_cachefile($file, $writemode = true)
function get_itemcachepath() function get_itemcachepath()

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Search;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Network\Probe; use Friendica\Network\Probe;
@ -508,7 +509,7 @@ class GContact
$done[] = DI::baseUrl() . '/poco'; $done[] = DI::baseUrl() . '/poco';
if (strlen(Config::get('system', 'directory'))) { if (strlen(Config::get('system', 'directory'))) {
$x = Network::fetchUrl(get_server() . '/pubsites'); $x = Network::fetchUrl(Search::getGlobalDirectory() . '/pubsites');
if (!empty($x)) { if (!empty($x)) {
$j = json_decode($x); $j = json_decode($x);
if (!empty($j->entries)) { if (!empty($j->entries)) {

View file

@ -10,6 +10,7 @@ use DOMDocument;
use DOMXPath; use DOMXPath;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Module\Register; use Friendica\Module\Register;
use Friendica\Network\CurlResult; use Friendica\Network\CurlResult;

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Core\StorageManager; use Friendica\Core\StorageManager;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -584,7 +585,7 @@ class Site extends BaseAdminModule
'$banner' => ['banner', L10n::t('Banner/Logo'), $banner, ''], '$banner' => ['banner', L10n::t('Banner/Logo'), $banner, ''],
'$shortcut_icon' => ['shortcut_icon', L10n::t('Shortcut icon'), Config::get('system', 'shortcut_icon'), L10n::t('Link to an icon that will be used for browsers.')], '$shortcut_icon' => ['shortcut_icon', L10n::t('Shortcut icon'), Config::get('system', 'shortcut_icon'), L10n::t('Link to an icon that will be used for browsers.')],
'$touch_icon' => ['touch_icon', L10n::t('Touch icon'), Config::get('system', 'touch_icon'), L10n::t('Link to an icon that will be used for tablets and mobiles.')], '$touch_icon' => ['touch_icon', L10n::t('Touch icon'), Config::get('system', 'touch_icon'), L10n::t('Link to an icon that will be used for tablets and mobiles.')],
'$additional_info' => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())], '$additional_info' => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory()],
'$language' => ['language', L10n::t('System language'), Config::get('system', 'language'), '', $lang_choices], '$language' => ['language', L10n::t('System language'), Config::get('system', 'language'), '', $lang_choices],
'$theme' => ['theme', L10n::t('System theme'), Config::get('system', 'theme'), L10n::t('Default system theme - may be over-ridden by user profiles - <a href="/admin/themes" id="cnftheme">Change default theme settings</a>'), $theme_choices], '$theme' => ['theme', L10n::t('System theme'), Config::get('system', 'theme'), L10n::t('Default system theme - may be over-ridden by user profiles - <a href="/admin/themes" id="cnftheme">Change default theme settings</a>'), $theme_choices],
'$theme_mobile' => ['theme_mobile', L10n::t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), L10n::t('Theme for mobile devices'), $theme_choices_mobile], '$theme_mobile' => ['theme_mobile', L10n::t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), L10n::t('Theme for mobile devices'), $theme_choices_mobile],

View file

@ -2,7 +2,6 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\App\Arguments;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Pager; use Friendica\Content\Pager;
@ -15,7 +14,6 @@ use Friendica\Network\HTTPException;
use Friendica\Object\Search\ContactResult; use Friendica\Object\Search\ContactResult;
use Friendica\Object\Search\ResultList; use Friendica\Object\Search\ResultList;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
/** /**
* Base class for search modules * Base class for search modules
@ -136,7 +134,7 @@ class BaseSearchModule extends BaseModule
$photo_menu['follow'] = [L10n::t("Connect/Follow"), $connLink]; $photo_menu['follow'] = [L10n::t("Connect/Follow"), $connLink];
} }
$photo = str_replace("http:///photo/", get_server() . "/photo/", $result->getPhoto()); $photo = str_replace("http:///photo/", Search::getGlobalDirectory() . "/photo/", $result->getPhoto());
$entry = [ $entry = [
'alt_text' => $alt_text, 'alt_text' => $alt_text,

View file

@ -460,7 +460,7 @@ class Feed {
$item["body"] = '[abstract]' . HTML::toBBCode($summary, $basepath) . "[/abstract]\n" . $item["body"]; $item["body"] = '[abstract]' . HTML::toBBCode($summary, $basepath) . "[/abstract]\n" . $item["body"];
} }
if ($contact["fetch_further_information"] == 3) { if (!empty($contact["fetch_further_information"]) && ($contact["fetch_further_information"] == 3)) {
if (!empty($tags)) { if (!empty($tags)) {
$item["tag"] = $tags; $item["tag"] = $tags;
} else { } else {

View file

@ -8,6 +8,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Search;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\GServer; use Friendica\Model\GServer;
@ -34,7 +35,7 @@ class SearchDirectory
} }
} }
$x = Network::fetchUrl(get_server() . '/lsearch?p=1&n=500&search=' . urlencode($search)); $x = Network::fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
$j = json_decode($x); $j = json_decode($x);
if (!empty($j->results)) { if (!empty($j->results)) {

View file

@ -16,6 +16,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -183,7 +184,7 @@ function vier_community_info()
$nv['random'] = L10n::t('Random Profile'); $nv['random'] = L10n::t('Random Profile');
$nv['inv'] = L10n::t('Invite Friends'); $nv['inv'] = L10n::t('Invite Friends');
$nv['directory'] = L10n::t('Global Directory'); $nv['directory'] = L10n::t('Global Directory');
$nv['global_dir'] = get_server(); $nv['global_dir'] = Search::getGlobalDirectory();
$nv['local_directory'] = L10n::t('Local Directory'); $nv['local_directory'] = L10n::t('Local Directory');
$aside['$nv'] = $nv; $aside['$nv'] = $nv;