diff --git a/config/local-sample.config.php b/config/local-sample.config.php index 2e9c02b42..069e5834f 100644 --- a/config/local-sample.config.php +++ b/config/local-sample.config.php @@ -36,7 +36,6 @@ return [ 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, 'register_text' => '', - 'hostname' => 'friendica.local', ], 'system' => [ 'default_timezone' => 'UTC', diff --git a/database.sql b/database.sql index e890d7421..fa11843e4 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1514 +-- DB_UPDATE_VERSION 1516 -- ------------------------------------------ diff --git a/doc/database/db_config.md b/doc/database/db_config.md new file mode 100644 index 000000000..66796caeb --- /dev/null +++ b/doc/database/db_config.md @@ -0,0 +1,25 @@ +Table config +=========== + +main configuration storage + +Fields +------ + +| Field | Description | Type | Null | Key | Default | Extra | +| ----- | ------------------------- | ------------- | ---- | --- | ------- | -------------- | +| id | | int unsigned | NO | PRI | NULL | auto_increment | +| cat | The category of the entry | varbinary(50) | NO | | | | +| k | The key of the entry | varbinary(50) | NO | | | | +| v | | mediumtext | YES | | NULL | | + +Indexes +------------ + +| Name | Fields | +| ------- | -------------- | +| PRIMARY | id | +| cat_k | UNIQUE, cat, k | + + +Return to [database documentation](help/database) diff --git a/index.php b/index.php index 34952afcb..90df9c00e 100644 --- a/index.php +++ b/index.php @@ -48,5 +48,6 @@ $a->runFrontend( $dice->create(\Friendica\Content\Nav::class), $dice->create(Friendica\Module\Special\HTTPException::class), new \Friendica\Util\HTTPInputData($_SERVER), - $start_time + $start_time, + $_SERVER ); diff --git a/mod/message.php b/mod/message.php index 726db0a75..1e8c012ee 100644 --- a/mod/message.php +++ b/mod/message.php @@ -58,7 +58,6 @@ function message_init(App $a) $head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ - '$baseurl' => DI::baseUrl()->get(true), '$base' => $base ]); } @@ -178,7 +177,6 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl()->get(true), '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -284,7 +282,6 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl()->get(true), '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); diff --git a/mods/local.config.ci.php b/mods/local.config.ci.php index 66e80a809..2da6b2a1a 100644 --- a/mods/local.config.ci.php +++ b/mods/local.config.ci.php @@ -35,7 +35,6 @@ return [ // **************************************************************** 'config' => [ - 'hostname' => 'friendica.local', 'admin_email' => 'admin@friendica.local', 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, @@ -44,9 +43,7 @@ return [ 'system' => [ 'default_timezone' => 'UTC', 'language' => 'en', - 'ssl_policy' => \Friendica\App\BaseURL::SSL_POLICY_SELFSIGN, 'url' => 'https://friendica.local', - 'urlpath' => '', // don't start unexpected worker.php processes during test! 'worker_dont_fork' => true, ], diff --git a/mods/local.config.vagrant.php b/mods/local.config.vagrant.php index 379ddf185..16426f932 100644 --- a/mods/local.config.vagrant.php +++ b/mods/local.config.vagrant.php @@ -29,7 +29,6 @@ return [ // **************************************************************** 'config' => [ - 'hostname' => '192.168.56.10', 'admin_email' => 'admin@friendica.local', 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, @@ -39,8 +38,6 @@ return [ 'default_timezone' => 'UTC', 'language' => 'en', 'basepath' => '/vagrant', - 'ssl_policy' => \Friendica\App\BaseURL::SSL_POLICY_SELFSIGN, 'url' => 'https://192.168.56.10', - 'urlpath' => '', ], ]; diff --git a/src/App.php b/src/App.php index 9df62a4e7..792df0f74 100644 --- a/src/App.php +++ b/src/App.php @@ -555,11 +555,12 @@ class App * @param ModuleHTTPException $httpException The possible HTTP Exception container * @param HTTPInputData $httpInput A library for processing PHP input streams * @param float $start_time The start time of the overall script execution + * @param array $server The $_SERVER array * * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ - public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time) + public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time, array $server) { $this->profiler->set($start_time, 'start'); $this->profiler->set(microtime(true), 'classinit'); @@ -575,10 +576,12 @@ class App if (!$this->mode->isInstall()) { // Force SSL redirection - if ($this->baseURL->checkRedirectHttps()) { - System::externalRedirect($this->baseURL->get() . '/' . $this->args->getQueryString()); + if ($this->config->get('system', 'force_ssl') && + (empty($server['HTTPS']) || $server['HTTPS'] === 'off') && + !empty($server['REQUEST_METHOD']) && + $server['REQUEST_METHOD'] === 'GET') { + System::externalRedirect($this->baseURL . '/' . $this->args->getQueryString()); } - Core\Hook::callAll('init_1'); } diff --git a/src/App/BaseURL.php b/src/App/BaseURL.php index 564527a65..403030684 100644 --- a/src/App/BaseURL.php +++ b/src/App/BaseURL.php @@ -23,284 +23,64 @@ namespace Friendica\App; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\System; -use Friendica\Util\Network; use Friendica\Util\Strings; use Friendica\Network\HTTPException; +use GuzzleHttp\Psr7\ServerRequest; +use GuzzleHttp\Psr7\Uri; +use Psr\Http\Message\UriInterface; +use Psr\Log\LoggerInterface; /** * A class which checks and contains the basic * environment for the BaseURL (url, urlpath, ssl_policy, hostname, scheme) */ -class BaseURL +class BaseURL extends Uri implements UriInterface { - /** - * No SSL necessary - */ - const SSL_POLICY_NONE = 0; - - /** - * SSL is necessary - */ - const SSL_POLICY_FULL = 1; - - /** - * SSL is optional, but preferred - */ - const SSL_POLICY_SELFSIGN = 2; - - /** - * Define the Default SSL scheme - */ - const DEFAULT_SSL_SCHEME = self::SSL_POLICY_SELFSIGN; - - /** - * The Friendica Config - * - * @var IManageConfigValues - */ - private $config; - - /** - * The server side variables - * - * @var array - */ - private $server; - - /** - * The hostname of the Base URL - * - * @var string - */ - private $hostname; - - /** - * The SSL_POLICY of the Base URL - * - * @var int - */ - private $sslPolicy; - - /** - * The URL sub-path of the Base URL - * - * @var string - */ - private $urlPath; - - /** - * The full URL - * - * @var string - */ - private $url; - - /** - * The current scheme of this call - * - * @var string - */ - private $scheme; - - /** - * Returns the hostname of this node - * - * @return string - */ - public function getHostname(): string + public function __construct(IManageConfigValues $config, LoggerInterface $logger, array $server = []) { - return $this->hostname; + $url = $config->get('system', 'url'); + if (empty($url)) { + $logger->critical('Invalid config - Missing system.url'); + $url = ServerRequest::getUriFromGlobals() + ->withQuery('') + ->withPath($this->determineURLPath($server)); + } + + parent::__construct($url); } /** - * Returns the current scheme of this call - * - * @return string + * Figure out if we are running at the top of a domain or in a subdirectory */ - public function getScheme(): string + private function determineURLPath(array $server): string { - return $this->scheme; - } + /* Relative script path to the web server root + * Not all of those $_SERVER properties can be present, so we do by inverse priority order + */ + $relativeScriptPath = + ($server['REDIRECT_URL'] ?? '') ?: + ($server['REDIRECT_URI'] ?? '') ?: + ($server['REDIRECT_SCRIPT_URL'] ?? '') ?: + ($server['SCRIPT_URL'] ?? '') ?: + $server['REQUEST_URI'] ?? ''; - /** - * Returns the SSL policy of this node - * - * @return int - */ - public function getSSLPolicy(): int - { - return $this->sslPolicy; - } - - /** - * Returns the sub-path of this URL - * - * @return string - */ - public function getUrlPath(): string - { - return $this->urlPath; - } - - /** - * Returns the full URL of this call - * - * Note: $ssl parameter value doesn't directly correlate with the resulting protocol - * - * @param bool $ssl True, if ssl should get used - * - * @return string - */ - public function get(bool $ssl = false): string - { - if ($this->sslPolicy === self::SSL_POLICY_SELFSIGN && $ssl) { - return Network::switchScheme($this->url); - } - - return $this->url; - } - - /** - * Save current parts of the base Url - * - * @param string? $hostname - * @param int? $sslPolicy - * @param string? $urlPath - * - * @return bool true, if successful - * @TODO Find proper types - */ - public function save($hostname = null, $sslPolicy = null, $urlPath = null): bool - { - $currUrl = $this->url; - - $configTransaction = $this->config->beginTransaction(); - - if (!empty($hostname) && $hostname !== $this->hostname) { - $configTransaction->set('config', 'hostname', $hostname); - $this->hostname = $hostname; - } - - if (isset($sslPolicy) && $sslPolicy !== $this->sslPolicy) { - $configTransaction->set('system', 'ssl_policy', $sslPolicy); - $this->sslPolicy = $sslPolicy; - } - - if (isset($urlPath) && $urlPath !== $this->urlPath) { - $configTransaction->set('system', 'urlpath', $urlPath); - $this->urlPath = $urlPath; - } - - $this->determineBaseUrl(); - if ($this->url !== $currUrl) { - $configTransaction->set('system', 'url', $this->url); - } - - $configTransaction->commit(); - - return true; - } - - /** - * Save the current url as base URL - * - * @param string $url - * - * @return bool true, if the save was successful - */ - public function saveByURL(string $url): bool - { - $parsed = @parse_url($url); - - if (empty($parsed) || empty($parsed['host'])) { - return false; - } - - $hostname = $parsed['host']; - if (!empty($hostname) && !empty($parsed['port'])) { - $hostname .= ':' . $parsed['port']; - } - - $urlPath = null; - if (!empty($parsed['path'])) { - $urlPath = trim($parsed['path'], '\\/'); - } - - $sslPolicy = null; - if (!empty($parsed['scheme'])) { - if ($parsed['scheme'] == 'https') { - $sslPolicy = BaseURL::SSL_POLICY_FULL; + /* $relativeScriptPath gives /relative/path/to/friendica/module/parameter + * QUERY_STRING gives pagename=module/parameter + * + * To get /relative/path/to/friendica we perform dirname() for as many levels as there are slashes in the QUERY_STRING + */ + if (!empty($relativeScriptPath)) { + // Module + if (!empty($server['QUERY_STRING'])) { + return trim(dirname($relativeScriptPath, substr_count(trim($server['QUERY_STRING'], '/'), '/') + 1), '/'); + } else { + // Root page + $scriptPathParts = explode('?', $relativeScriptPath, 2); + return trim($scriptPathParts[0], '/'); } } - return $this->save($hostname, $sslPolicy, $urlPath); - } - - /** - * Checks, if a redirect to the HTTPS site would be necessary - * - * @return bool - */ - public function checkRedirectHttps() - { - return $this->config->get('system', 'force_ssl') && - ($this->getScheme() == "http") && - intval($this->getSSLPolicy()) == BaseURL::SSL_POLICY_FULL && - strpos($this->get(), 'https://') === 0 && - !empty($this->server['REQUEST_METHOD']) && - $this->server['REQUEST_METHOD'] === 'GET'; - } - - /** - * @param IManageConfigValues $config The Friendica IConfiguration - * @param array $server The $_SERVER array - */ - public function __construct(IManageConfigValues $config, array $server) - { - $this->config = $config; - $this->server = $server; - $this->hostname = $this->config->get('config', 'hostname'); - $this->urlPath = $this->config->get('system', 'urlpath') ?? ''; - $this->sslPolicy = $this->config->get('system', 'ssl_policy') ?? static::DEFAULT_SSL_SCHEME; - $this->url = $this->config->get('system', 'url'); - - if (empty($this->hostname) || empty($this->url)) { - throw new \Exception('Invalid config - Missing system.url or config.hostname'); - } - - $this->determineSchema(); - } - - /** - * Determine the full URL based on all parts - */ - private function determineBaseUrl() - { - $scheme = 'http'; - - if ($this->sslPolicy == self::SSL_POLICY_FULL) { - $scheme = 'https'; - } - - $this->url = $scheme . '://' . $this->hostname . (!empty($this->urlPath) ? '/' . $this->urlPath : ''); - } - - /** - * Determine the scheme of the current used link - */ - private function determineSchema() - { - $this->scheme = 'http'; - - if (!empty($this->server['HTTPS']) || - !empty($this->server['HTTP_FORWARDED']) && preg_match('/proto=https/', $this->server['HTTP_FORWARDED']) || - !empty($this->server['HTTP_X_FORWARDED_PROTO']) && $this->server['HTTP_X_FORWARDED_PROTO'] == 'https' || - !empty($this->server['HTTP_X_FORWARDED_SSL']) && $this->server['HTTP_X_FORWARDED_SSL'] == 'on' || - !empty($this->server['FRONT_END_HTTPS']) && $this->server['FRONT_END_HTTPS'] == 'on' || - !empty($this->server['SERVER_PORT']) && (intval($this->server['SERVER_PORT']) == 443) // XXX: reasonable assumption, but isn't this hardcoding too much? - ) { - $this->scheme = 'https'; - } + return ''; } /** @@ -314,11 +94,11 @@ class BaseURL { // Remove the hostname from the url if it is an internal link $nurl = Strings::normaliseLink($origURL); - $base = Strings::normaliseLink($this->get()); + $base = Strings::normaliseLink($this->__toString()); $url = str_replace($base . '/', '', $nurl); - // if it is an external link return the orignal value - if ($url == Strings::normaliseLink($origURL)) { + // if it is an external link return the original value + if ($url === $nurl) { return $origURL; } else { return $url; @@ -344,15 +124,7 @@ class BaseURL throw new HTTPException\InternalServerErrorException("$toUrl is not a relative path, please use System::externalRedirectTo"); } - $redirectTo = $this->get($ssl) . '/' . ltrim($toUrl, '/'); + $redirectTo = $this->__toString() . '/' . ltrim($toUrl, '/'); System::externalRedirect($redirectTo); } - - /** - * Returns the base url as string - */ - public function __toString(): string - { - return (string) $this->get(); - } } diff --git a/src/App/Page.php b/src/App/Page.php index a91d400ee..e22625212 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -523,7 +523,7 @@ class Page implements ArrayAccess 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)) { + if ($config->get('system', 'hsts') && ($baseURL->getScheme() === 'https')) { header("Strict-Transport-Security: max-age=31536000"); } diff --git a/src/Console/AutomaticInstallation.php b/src/Console/AutomaticInstallation.php index 83c6ac4c3..1ce516e25 100644 --- a/src/Console/AutomaticInstallation.php +++ b/src/Console/AutomaticInstallation.php @@ -199,8 +199,7 @@ HELP; $this->out('The Friendica URL has to be set during CLI installation.'); return 1; } else { - $baseUrl = new BaseURL($this->config, []); - $baseUrl->saveByURL($url); + $configCache->set('system', 'url', $url); } $installer->createConfig($configCache); diff --git a/src/Console/MoveToAvatarCache.php b/src/Console/MoveToAvatarCache.php index 13a8debcb..055b0c2c0 100644 --- a/src/Console/MoveToAvatarCache.php +++ b/src/Console/MoveToAvatarCache.php @@ -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 . '/photo/%', 0, 0, Protocol::MAIL, Protocol::FEED]; $count = 0; $total = $this->dba->count('contact', $condition); diff --git a/src/Console/Relocate.php b/src/Console/Relocate.php index c63434cbb..a6fdd8bfb 100644 --- a/src/Console/Relocate.php +++ b/src/Console/Relocate.php @@ -92,9 +92,9 @@ HELP; throw new \InvalidArgumentException('Can not parse new base URL. Must have at least ://'); } - $this->out(sprintf('Relocation started from %s to %s. Could take a while to complete.', $this->baseUrl->get(true), $this->getArgument(0))); + $this->out(sprintf('Relocation started from %s to %s. Could take a while to complete.', $this->baseUrl, $this->getArgument(0))); - $old_url = $this->baseUrl->get(true); + $old_url = $this->baseUrl; // Generate host names for relocation the addresses in the format user@address.tld $new_host = str_replace('http://', '@', Strings::normaliseLink($new_url)); @@ -179,7 +179,6 @@ HELP; // update config $this->out('Updating config values'); $this->config->set('system', 'url', $new_url); - $this->baseUrl->saveByURL($new_url); $this->database->commit(); } catch (\Throwable $e) { diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index de4b69038..810775953 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -314,7 +314,7 @@ class Conversation $tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $this->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$newpost' => 'true', - '$baseurl' => $this->baseURL->get(true), + '$baseurl' => $this->baseURL, '$geotag' => $geotag, '$nickname' => $x['nickname'], '$ispublic' => $this->l10n->t('Visible to everybody'), @@ -385,7 +385,7 @@ class Conversation '$posttype' => $notes_cid ? ItemModel::PT_PERSONAL_NOTE : ItemModel::PT_ARTICLE, '$content' => $x['content'] ?? '', '$post_id' => $x['post_id'] ?? '', - '$baseurl' => $this->baseURL->get(true), + '$baseurl' => $this->baseURL, '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$pvisit' => $notes_cid ? 'none' : $x['visitor'], @@ -446,8 +446,6 @@ class Conversation $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); - $ssl_state = (bool)$this->session->getLocalUserId(); - $live_update_div = ''; $blocklist = $this->getBlocklist(); @@ -784,7 +782,7 @@ class Conversation } $o = Renderer::replaceMacros($page_template, [ - '$baseurl' => $this->baseURL->get($ssl_state), + '$baseurl' => $this->baseURL, '$return_path' => $this->args->getQueryString(), '$live_update' => $live_update_div, '$remove' => $this->l10n->t('remove'), diff --git a/src/Content/Item.php b/src/Content/Item.php index 0d47cde92..2e86fb82d 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -903,7 +903,7 @@ class Item if ($post['attach']) { $post['attach'] .= ','; } - $post['attach'] .= Post\Media::getAttachElement($this->baseURL->get() . '/attach/' . $attachment['id'], + $post['attach'] .= Post\Media::getAttachElement($this->baseURL . '/attach/' . $attachment['id'], $attachment['filesize'], $attachment['filetype'], $attachment['filename'] ?? ''); $fields = ['allow_cid' => $post['allow_cid'], 'allow_gid' => $post['allow_gid'], diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 63eeede89..470882b07 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -184,8 +184,6 @@ class Nav */ private function getInfo(): array { - $ssl_state = (bool) $this->session->getLocalUserId(); - /* * Our network is distributed, and as you visit friends some * sites look exactly the same - it isn't always easy to know where you are. @@ -194,7 +192,7 @@ class Nav $myident = !empty($this->session->getLocalUserNickname()) ? $this->session->getLocalUserNickname() . '@' : ''; - $sitelocation = $myident . substr($this->baseUrl->get($ssl_state), strpos($this->baseUrl->get($ssl_state), '//') + 2); + $sitelocation = $myident . substr($this->baseUrl, strpos($this->baseUrl, '//') + 2); $nav = [ 'admin' => null, diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 83056b269..6730309e6 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1274,7 +1274,7 @@ class BBCode private static function cleanPictureLinksCallback(array $match): string { // When the picture link is the own photo path then we can avoid fetching the link - $own_photo_url = preg_quote(Strings::normaliseLink(DI::baseUrl()->get()) . '/photos/'); + $own_photo_url = preg_quote(Strings::normaliseLink(DI::baseUrl()) . '/photos/'); if (preg_match('|' . $own_photo_url . '.*?/image/|', Strings::normaliseLink($match[1]))) { if (!empty($match[3])) { $text = '[img=' . str_replace('-1.', '-0.', $match[2]) . ']' . $match[3] . '[/img]'; @@ -2099,8 +2099,8 @@ class BBCode // Default iframe allowed domains/path $allowedIframeDomains = [ - DI::baseUrl()->getHostname() - . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '') + DI::baseUrl()->getHost() + . (DI::baseUrl()->getPath() ? '/' . DI::baseUrl()->getPath() : '') . '/oembed/', # The path part has to change with the source in Content\Oembed::iframe 'www.youtube.com/embed/', 'player.vimeo.com/video/', diff --git a/src/Core/Cache/Factory/Cache.php b/src/Core/Cache/Factory/Cache.php index 715a09f4a..107c6ab21 100644 --- a/src/Core/Cache/Factory/Cache.php +++ b/src/Core/Cache/Factory/Cache.php @@ -73,7 +73,7 @@ class Cache public function __construct(BaseURL $baseURL, IManageConfigValues $config, Database $dba, Profiler $profiler, LoggerInterface $logger) { - $this->hostname = $baseURL->getHostname(); + $this->hostname = $baseURL->getHost(); $this->config = $config; $this->dba = $dba; $this->profiler = $profiler; diff --git a/src/Core/Config/Model/DatabaseConfig.php b/src/Core/Config/Model/DatabaseConfig.php index 01366cf71..7167ccbf8 100644 --- a/src/Core/Config/Model/DatabaseConfig.php +++ b/src/Core/Config/Model/DatabaseConfig.php @@ -61,15 +61,13 @@ class DatabaseConfig implements IManageConfigValues foreach ($setCache->getAll() as $category => $data) { foreach ($data as $key => $value) { - $this->cache->set($category, $key, $value, Cache::SOURCE_DATA); - $this->database->insert('config', ['cat' => $category, 'k' => $key, 'v' => serialize($value)], Database::INSERT_UPDATE); + $this->set($category, $key, $value); } } foreach ($delCache->getAll() as $category => $keys) { foreach ($keys as $key => $value) { - $this->cache->delete($category, $key); - $this->database->delete('config', ['cat' => $category, 'k' => $key]); + $this->delete($category, $key); } } @@ -85,6 +83,10 @@ class DatabaseConfig implements IManageConfigValues /** {@inheritDoc} */ public function set(string $cat, string $key, $value): bool { + // In case someone or something already serialized a config entry, unserialize it first + // We serialize values just once + $value = SerializeUtil::maybeUnserialize($value); + $this->cache->set($cat, $key, $value, Cache::SOURCE_DATA); return $this->database->insert('config', ['cat' => $cat, 'k' => $key, 'v' => serialize($value)], Database::INSERT_UPDATE); } diff --git a/src/Core/Config/Util/SerializeUtil.php b/src/Core/Config/Util/SerializeUtil.php index 0a886e230..821633ac4 100644 --- a/src/Core/Config/Util/SerializeUtil.php +++ b/src/Core/Config/Util/SerializeUtil.php @@ -28,10 +28,24 @@ namespace Friendica\Core\Config\Util; */ class SerializeUtil { + /** + * Checks if the value needs to get unserialized and returns the unserialized value + * + * @param mixed $value A possibly serialized value + * + * @return mixed The unserialized value + */ public static function maybeUnserialize($value) { - if (static::isSerialized($value)) { - return @unserialize(trim($value)); + // This checks for possible multiple serialized values + while (static::isSerialized($value)) { + $oldValue = $value; + $value = @unserialize($value); + + // If there's no change after the unserialize call, break the loop (avoid endless loops) + if ($oldValue === $value) { + break; + } } return $value; diff --git a/src/Core/Installer.php b/src/Core/Installer.php index fd8663471..b3d6e2911 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -158,23 +158,20 @@ class Installer { $basepath = $configCache->get('system', 'basepath'); - $tpl = Renderer::getMarkupTemplate('local.config.tpl'); + $tpl = Renderer::getMarkupTemplate('install/local.config.tpl'); $txt = Renderer::replaceMacros($tpl, [ - '$dbhost' => $configCache->get('database', 'hostname'), - '$dbuser' => $configCache->get('database', 'username'), - '$dbpass' => $configCache->get('database', 'password'), - '$dbdata' => $configCache->get('database', 'database'), + '$dbhost' => $configCache->get('database', 'hostname'), + '$dbuser' => $configCache->get('database', 'username'), + '$dbpass' => $configCache->get('database', 'password'), + '$dbdata' => $configCache->get('database', 'database'), - '$phpath' => $configCache->get('config', 'php_path'), - '$adminmail' => $configCache->get('config', 'admin_email'), - '$hostname' => $configCache->get('config', 'hostname'), + '$phpath' => $configCache->get('config', 'php_path'), + '$adminmail' => $configCache->get('config', 'admin_email'), - '$urlpath' => $configCache->get('system', 'urlpath'), - '$baseurl' => $configCache->get('system', 'url'), - '$sslpolicy' => $configCache->get('system', 'ssl_policy'), - '$basepath' => $basepath, - '$timezone' => $configCache->get('system', 'default_timezone'), - '$language' => $configCache->get('system', 'language'), + '$system_url' => $configCache->get('system', 'url'), + '$basepath' => $basepath, + '$timezone' => $configCache->get('system', 'default_timezone'), + '$language' => $configCache->get('system', 'language'), ]); $result = file_put_contents($basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.config.php', $txt); diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 0204d54b5..7f11f3f8e 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -76,7 +76,7 @@ class Renderer DI::profiler()->startRecording('rendering'); // pass $baseurl to all templates if it isn't set - $vars = array_merge(['$baseurl' => DI::baseUrl()->get(), '$APP' => DI::app()], $vars); + $vars = array_merge(['$baseurl' => DI::baseUrl(), '$APP' => DI::app()], $vars); $t = self::getTemplateEngine(); diff --git a/src/Core/Session/Type/Native.php b/src/Core/Session/Type/Native.php index 943050e05..2804a7346 100644 --- a/src/Core/Session/Type/Native.php +++ b/src/Core/Session/Type/Native.php @@ -37,7 +37,7 @@ class Native extends AbstractSession implements IHandleSessions ini_set('session.use_only_cookies', 1); ini_set('session.cookie_httponly', (int)Cookie::HTTPONLY); - if ($baseURL->getSSLPolicy() == App\BaseURL::SSL_POLICY_FULL) { + if ($baseURL->getScheme() === 'https') { ini_set('session.cookie_secure', 1); } diff --git a/src/Core/System.php b/src/Core/System.php index bbcb3ab09..107303d6a 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -401,7 +401,7 @@ class System if (is_bool($prefix) && !$prefix) { $prefix = ''; } elseif (empty($prefix)) { - $prefix = hash('crc32', DI::baseUrl()->getHostname()); + $prefix = hash('crc32', DI::baseUrl()->getHost()); } while (strlen($prefix) < ($size - 13)) { @@ -604,7 +604,7 @@ class System $temppath = BasePath::getRealPath($temppath); // To avoid any interferences with other systems we create our own directory - $new_temppath = $temppath . "/" . DI::baseUrl()->getHostname(); + $new_temppath = $temppath . "/" . DI::baseUrl()->getHost(); if (!is_dir($new_temppath)) { /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method? mkdir($new_temppath); diff --git a/src/DI.php b/src/DI.php index 78eb5bee4..cc765fa52 100644 --- a/src/DI.php +++ b/src/DI.php @@ -126,10 +126,7 @@ abstract class DI return self::$dice->create(App\Arguments::class); } - /** - * @return App\BaseURL - */ - public static function baseUrl() + public static function baseUrl(): App\BaseURL { return self::$dice->create(App\BaseURL::class); } diff --git a/src/Factory/Api/Friendica/Photo.php b/src/Factory/Api/Friendica/Photo.php index ced0774e8..63592614e 100644 --- a/src/Factory/Api/Friendica/Photo.php +++ b/src/Factory/Api/Friendica/Photo.php @@ -90,7 +90,7 @@ class Photo extends BaseFactory } foreach ($photos as $id => $photo) { - $link = $this->baseUrl->get() . '/photo/' . $data['resource-id'] . '-' . $photo['scale'] . Images::getExtensionByMimeType($data['type']); + $link = $this->baseUrl . '/photo/' . $data['resource-id'] . '-' . $photo['scale'] . Images::getExtensionByMimeType($data['type']); if ($type == 'xml') { $data['links'][$photo['scale'] . ':link']['@attributes'] = [ 'type' => $data['type'], diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 0ff29f888..571253f42 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -570,7 +570,7 @@ class Contact { if (!parse_url($url, PHP_URL_SCHEME)) { $addr_parts = explode('@', $url); - return (count($addr_parts) == 2) && ($addr_parts[1] == DI::baseUrl()->getHostname()); + return (count($addr_parts) == 2) && ($addr_parts[1] == DI::baseUrl()->getHost()); } return Strings::compareLink(self::getBasepath($url, true), DI::baseUrl()); diff --git a/src/Model/Item.php b/src/Model/Item.php index b2daed13e..feb7ae6be 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -408,7 +408,7 @@ class Item if ($notify) { // We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri. // We add the hash of our own host because our host is the original creator of the post. - $prefix_host = DI::baseUrl()->getHostname(); + $prefix_host = DI::baseUrl()->getHost(); } else { $prefix_host = ''; @@ -1211,7 +1211,7 @@ class Item Post\Thread::insert($item['uri-id'], $item); } - // The content of activities normally doesn't matter - except for likes from Misskey + // The content of activities normally doesn't matter - except for likes from Misskey if (!in_array($item['verb'], self::ACTIVITIES) || in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE]) && !empty($item['body']) && ($item['body'] != $item['verb'])) { Post\Content::insert($item['uri-id'], $item); } @@ -1715,7 +1715,7 @@ class Item if (!empty($item['event-id'])) { $event_post = Post::selectFirst(['event-id'], ['uri-id' => $item['uri-id'], 'uid' => $uid]); if (!empty($event_post['event-id'])) { - $event = DBA::selectFirst('event', ['edited', 'start', 'finish', 'summary', 'desc', 'location', 'nofinish', 'adjust'], ['id' => $item['event-id']]); + $event = DBA::selectFirst('event', ['edited', 'start', 'finish', 'summary', 'desc', 'location', 'nofinish'], ['id' => $item['event-id']]); if (!empty($event)) { // We aren't using "Event::store" here, since we don't want to trigger any further action $ret = DBA::update('event', $event, ['id' => $event_post['event-id']]); @@ -2048,7 +2048,7 @@ class Item $guid = System::createUUID(); } - return DI::baseUrl()->get() . '/objects/' . $guid; + return DI::baseUrl() . '/objects/' . $guid; } /** @@ -2288,7 +2288,7 @@ class Item } // Prevent to forward already forwarded posts - if ($datarray['app'] == DI::baseUrl()->getHostname()) { + if ($datarray['app'] == DI::baseUrl()->getHost()) { Logger::info('Already forwarded (second test)'); return false; } diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php index 07f56dd7b..51692f016 100644 --- a/src/Model/Nodeinfo.php +++ b/src/Model/Nodeinfo.php @@ -171,7 +171,7 @@ class Nodeinfo return [ 'name' => $administrator['username'] ?? null, 'contact' => $administrator['email'] ?? null, - 'account' => $administrator['nickname'] ?? '' ? DI::baseUrl()->get() . '/profile/' . $administrator['nickname'] : null, + 'account' => $administrator['nickname'] ?? '' ? DI::baseUrl() . '/profile/' . $administrator['nickname'] : null, ]; } } diff --git a/src/Model/Photo.php b/src/Model/Photo.php index bcb5b20f9..96c82b0c1 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -918,7 +918,7 @@ class Photo */ public static function getResourceData(string $name): array { - $base = DI::baseUrl()->get(); + $base = DI::baseUrl(); $guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name)); @@ -982,7 +982,7 @@ class Photo */ public static function isLocalPage(string $name): bool { - $base = DI::baseUrl()->get(); + $base = DI::baseUrl(); $guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name)); $guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid); diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 8ff942ba4..b30cca8a6 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -334,7 +334,7 @@ class Profile if (!$local_user_is_self) { if (!$visitor_is_authenticated) { // Remote follow is only available for local profiles - if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) { + if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()) === 0) { $follow_link = 'profile/' . $profile['nickname'] . '/remote_follow'; } } else { @@ -756,13 +756,13 @@ class Profile $query = rtrim(str_replace($addr_request, '', DI::args()->getQueryString()), '?&'); // The other instance needs to know where to redirect. - $dest = urlencode(DI::baseUrl()->get() . '/' . $query); + $dest = urlencode(DI::baseUrl() . '/' . $query); // We need to extract the basebath from the profile url // to redirect the visitors '/magic' module. $basepath = Contact::getBasepath($contact['url']); - if ($basepath != DI::baseUrl()->get() && !strstr($dest, '/magic')) { + if ($basepath != DI::baseUrl() && !strstr($dest, '/magic')) { $magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request; // We have to check if the remote server does understand /magic without invoking something @@ -870,7 +870,7 @@ class Profile $a->setContactId($arr['visitor']['id']); - DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name'])); + DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHost(), $visitor['name'])); Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']); } diff --git a/src/Model/Tag.php b/src/Model/Tag.php index d46680059..0e891f9c6 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -534,8 +534,11 @@ class Tag $searchpath = DI::baseUrl() . '/search?tag='; - $taglist = DBA::select('tag-view', ['type', 'name', 'url', 'cid'], - ['uri-id' => $item['uri-id'], 'type' => [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION]]); + $taglist = DBA::select( + 'tag-view', + ['type', 'name', 'url', 'cid'], + ['uri-id' => $item['uri-id'], 'type' => [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION]] + ); while ($tag = DBA::fetch($taglist)) { if ($tag['url'] == '') { $tag['url'] = $searchpath . rawurlencode($tag['name']); @@ -544,7 +547,7 @@ class Tag $orig_tag = $tag['url']; $prefix = self::TAG_CHARACTER[$tag['type']]; - switch($tag['type']) { + switch ($tag['type']) { case self::HASHTAG: if ($orig_tag != $tag['url']) { $item['body'] = str_replace($orig_tag, $tag['url'], $item['body']); @@ -639,17 +642,17 @@ class Tag * * @param int $period Period in hours to consider posts * @param int $limit Number of returned tags + * @param int $offset Page offset in results * @return array * @throws \Exception */ - public static function getGlobalTrendingHashtags(int $period, $limit = 10): array + public static function getGlobalTrendingHashtags(int $period, int $limit = 10, int $offset = 0): array { - $tags = DI::cache()->get('global_trending_tags-' . $period . '-' . $limit); - if (!empty($tags)) { - return $tags; - } else { - return self::setGlobalTrendingHashtags($period, $limit); + $tags = DI::cache()->get("global_trending_tags-$period"); + if (empty($tags)) { + $tags = self::setGlobalTrendingHashtags($period, 1000); } + return array_slice($tags, $offset, $limit); } /** @@ -665,7 +668,9 @@ class Tag } $blocked = explode(',', $blocked_txt); - array_walk($blocked, function(&$value) { $value = "'" . DBA::escape(trim($value)) . "'";}); + array_walk($blocked, function (&$value) { + $value = "'" . DBA::escape(trim($value)) . "'"; + }); return ' AND NOT `name` IN (' . implode(',', $blocked) . ')'; } @@ -683,8 +688,11 @@ class Tag * Get a uri-id that is at least X hours old. * We use the uri-id in the query for the hash tags since this is much faster */ - $post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')], - ['order' => ['received' => true]]); + $post = Post::selectFirstThread( + ['uri-id'], + ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')], + ['order' => ['received' => true]] + ); if (empty($post['uri-id'])) { return []; @@ -692,17 +700,20 @@ class Tag $block_sql = self::getBlockedSQL(); - $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors` + $tagsStmt = DBA::p( + "SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors` FROM `tag-search-view` WHERE `private` = ? AND `uid` = ? AND `uri-id` > ? $block_sql GROUP BY `term` ORDER BY `authors` DESC, `score` DESC LIMIT ?", - Item::PUBLIC, 0, $post['uri-id'], + Item::PUBLIC, + 0, + $post['uri-id'], $limit ); if (DBA::isResult($tagsStmt)) { $tags = DBA::toArray($tagsStmt); - DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY); + DI::cache()->set("global_trending_tags-$period", $tags, Duration::HOUR); return $tags; } @@ -714,17 +725,17 @@ class Tag * * @param int $period Period in hours to consider posts * @param int $limit Number of returned tags + * @param int $offset Page offset in results * @return array * @throws \Exception */ - public static function getLocalTrendingHashtags(int $period, $limit = 10): array + public static function getLocalTrendingHashtags(int $period, $limit = 10, int $offset = 0): array { - $tags = DI::cache()->get('local_trending_tags-' . $period . '-' . $limit); - if (!empty($tags)) { - return $tags; - } else { - return self::setLocalTrendingHashtags($period, $limit); + $tags = DI::cache()->get("local_trending_tags-$period"); + if (empty($tags)) { + $tags = self::setLocalTrendingHashtags($period, 1000); } + return array_slice($tags, $offset, $limit); } /** @@ -739,25 +750,30 @@ class Tag { // Get a uri-id that is at least X hours old. // We use the uri-id in the query for the hash tags since this is much faster - $post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')], - ['order' => ['received' => true]]); + $post = Post::selectFirstThread( + ['uri-id'], + ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')], + ['order' => ['received' => true]] + ); if (empty($post['uri-id'])) { return []; } $block_sql = self::getBlockedSQL(); - $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors` + $tagsStmt = DBA::p( + "SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors` FROM `tag-search-view` WHERE `private` = ? AND `wall` AND `origin` AND `uri-id` > ? $block_sql GROUP BY `term` ORDER BY `authors` DESC, `score` DESC LIMIT ?", - Item::PUBLIC, $post['uri-id'], + Item::PUBLIC, + $post['uri-id'], $limit ); if (DBA::isResult($tagsStmt)) { $tags = DBA::toArray($tagsStmt); - DI::cache()->set('local_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY); + DI::cache()->set("local_trending_tags-$period", $tags, Duration::HOUR); return $tags; } diff --git a/src/Model/User.php b/src/Model/User.php index 75b913250..b0ece9346 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -166,7 +166,7 @@ class User $system['region'] = ''; $system['postal-code'] = ''; $system['country-name'] = ''; - $system['homepage'] = DI::baseUrl()->get(); + $system['homepage'] = DI::baseUrl(); $system['dob'] = '0000-00-00'; // Ensure that the user contains data @@ -219,7 +219,7 @@ class User 'self' => true, 'network' => Protocol::ACTIVITYPUB, 'name' => 'System Account', - 'addr' => $system_actor_name . '@' . DI::baseUrl()->getHostname(), + 'addr' => $system_actor_name . '@' . DI::baseUrl()->getHost(), 'nick' => $system_actor_name, 'url' => DI::baseUrl() . '/friendica', 'pubkey' => $keys['pubkey'], @@ -1023,7 +1023,7 @@ class User $_SESSION['register'] = 1; $_SESSION['openid'] = $openid_url; - $openid = new LightOpenID(DI::baseUrl()->getHostname()); + $openid = new LightOpenID(DI::baseUrl()->getHost()); $openid->identity = $openid_url; $openid->returnUrl = DI::baseUrl() . '/openid'; $openid->required = ['namePerson/friendly', 'contact/email', 'namePerson']; @@ -1360,7 +1360,7 @@ class User $l10n, $user, DI::config()->get('config', 'sitename'), - DI::baseUrl()->get(), + DI::baseUrl(), ($register['password'] ?? '') ?: 'Sent in a previous email' ); } @@ -1457,7 +1457,7 @@ class User Thank you and welcome to %4$s.')); $preamble = sprintf($preamble, $user['username'], DI::config()->get('config', 'sitename')); - $body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename')); + $body = sprintf($body, DI::baseUrl(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename')); $email = DI::emailer() ->newSystemMail() diff --git a/src/Model/User/Cookie.php b/src/Model/User/Cookie.php index 96e82a3fa..aa89ae227 100644 --- a/src/Model/User/Cookie.php +++ b/src/Model/User/Cookie.php @@ -59,7 +59,7 @@ class Cookie */ public function __construct(App\Request $request, IManageConfigValues $config, App\BaseURL $baseURL, array $COOKIE = []) { - $this->sslEnabled = $baseURL->getSSLPolicy() === App\BaseURL::SSL_POLICY_FULL; + $this->sslEnabled = $baseURL->getScheme() === 'https'; $this->sitePrivateKey = $config->get('system', 'site_prvkey'); $authCookieDays = $config->get('system', 'auth_cookie_lifetime', diff --git a/src/Module/ActivityPub/Objects.php b/src/Module/ActivityPub/Objects.php index 7a396949e..34d460951 100644 --- a/src/Module/ActivityPub/Objects.php +++ b/src/Module/ActivityPub/Objects.php @@ -56,7 +56,7 @@ class Objects extends BaseModule Logger::info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]); } else { // The item URI does not always contain the GUID. This means that we have to search the URL instead - $url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString(); + $url = DI::baseUrl() . '/' . DI::args()->getQueryString(); $nurl = Strings::normaliseLink($url); $ssl_url = str_replace('http://', 'https://', $nurl); diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index 6786d89ee..1667f7d5c 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -112,7 +112,6 @@ class Details extends BaseAdmin '$page' => DI::l10n()->t('Addons'), '$toggle' => DI::l10n()->t('Toggle'), '$settings' => DI::l10n()->t('Settings'), - '$baseurl' => DI::baseUrl()->get(true), '$addon' => $addon, '$status' => $status, diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php index 25e6446fa..ca8e07501 100644 --- a/src/Module/Admin/Addons/Index.php +++ b/src/Module/Admin/Addons/Index.php @@ -68,7 +68,6 @@ class Index extends BaseAdmin '$page' => DI::l10n()->t('Addons'), '$submit' => DI::l10n()->t('Save Settings'), '$reload' => DI::l10n()->t('Reload active addons'), - '$baseurl' => DI::baseUrl()->get(true), '$function' => 'addons', '$addons' => $addons, '$pcount' => count($addons), diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php index cbc34eba7..942791887 100644 --- a/src/Module/Admin/DBSync.php +++ b/src/Module/Admin/DBSync.php @@ -102,13 +102,11 @@ class DBSync extends BaseAdmin if (!count($failed)) { $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [ - '$base' => DI::baseUrl()->get(true), '$banner' => DI::l10n()->t('No failed updates.'), '$check' => DI::l10n()->t('Check database structure'), ]); } else { $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [ - '$base' => DI::baseUrl()->get(true), '$banner' => DI::l10n()->t('Failed Updates'), '$desc' => DI::l10n()->t('This does not include updates prior to 1139, which did not return a status.'), '$mark' => DI::l10n()->t("Mark success \x28if update was manually applied\x29"), diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index 8878895c8..f3e55a7e9 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -81,7 +81,6 @@ class Features extends BaseAdmin $tpl = Renderer::getMarkupTemplate('admin/features.tpl'); $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => self::getFormSecurityToken("admin_manage_features"), - '$baseurl' => DI::baseUrl()->get(true), '$title' => DI::l10n()->t('Manage Additional Features'), '$features' => $features, '$submit' => DI::l10n()->t('Save Settings'), diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index 7cdbfb4f5..91b293871 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -80,7 +80,6 @@ class Settings extends BaseAdmin '$page' => DI::l10n()->t('Logs'), '$submit' => DI::l10n()->t('Save Settings'), '$clear' => DI::l10n()->t('Clear'), - '$baseurl' => DI::baseUrl()->get(true), '$logname' => DI::config()->get('system', 'logfile'), // see /help/smarty3-templates#1_1 on any Friendica node '$debugging' => ['debugging', DI::l10n()->t("Enable Debugging"), DI::config()->get('system', 'debugging'), ""], diff --git a/src/Module/Admin/Logs/View.php b/src/Module/Admin/Logs/View.php index 3cd00e08c..bab804f4e 100644 --- a/src/Module/Admin/Logs/View.php +++ b/src/Module/Admin/Logs/View.php @@ -80,7 +80,6 @@ class View extends BaseAdmin } } return Renderer::replaceMacros($t, [ - '$baseurl' => DI::baseUrl()->get(true), '$title' => DI::l10n()->t('Administration'), '$page' => DI::l10n()->t('View Logs'), '$l10n' => [ diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 39dc9f26d..8e2e10fab 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -118,7 +118,6 @@ class Site extends BaseAdmin $mail_enabled = !empty($_POST['mail_enabled']); $ostatus_enabled = !empty($_POST['ostatus_enabled']); $diaspora_enabled = !empty($_POST['diaspora_enabled']); - $ssl_policy = (!empty($_POST['ssl_policy']) ? intval($_POST['ssl_policy']) : 0); $force_ssl = !empty($_POST['force_ssl']); $show_help = !empty($_POST['show_help']); $dbclean = !empty($_POST['dbclean']); @@ -152,49 +151,10 @@ class Site extends BaseAdmin Worker::add(Worker::PRIORITY_LOW, 'Directory'); } - if (DI::baseUrl()->getUrlPath() != "") { + if (DI::baseUrl()->getPath() != "") { $diaspora_enabled = false; } - if ($ssl_policy != intval(DI::config()->get('system', 'ssl_policy'))) { - if ($ssl_policy == App\BaseURL::SSL_POLICY_FULL) { - DBA::e("UPDATE `contact` SET - `url` = REPLACE(`url` , 'http:' , 'https:'), - `photo` = REPLACE(`photo` , 'http:' , 'https:'), - `thumb` = REPLACE(`thumb` , 'http:' , 'https:'), - `micro` = REPLACE(`micro` , 'http:' , 'https:'), - `request` = REPLACE(`request`, 'http:' , 'https:'), - `notify` = REPLACE(`notify` , 'http:' , 'https:'), - `poll` = REPLACE(`poll` , 'http:' , 'https:'), - `confirm` = REPLACE(`confirm`, 'http:' , 'https:'), - `poco` = REPLACE(`poco` , 'http:' , 'https:') - WHERE `self` = 1" - ); - DBA::e("UPDATE `profile` SET - `photo` = REPLACE(`photo` , 'http:' , 'https:'), - `thumb` = REPLACE(`thumb` , 'http:' , 'https:') - WHERE 1 " - ); - } elseif ($ssl_policy == App\BaseURL::SSL_POLICY_SELFSIGN) { - DBA::e("UPDATE `contact` SET - `url` = REPLACE(`url` , 'https:' , 'http:'), - `photo` = REPLACE(`photo` , 'https:' , 'http:'), - `thumb` = REPLACE(`thumb` , 'https:' , 'http:'), - `micro` = REPLACE(`micro` , 'https:' , 'http:'), - `request` = REPLACE(`request`, 'https:' , 'http:'), - `notify` = REPLACE(`notify` , 'https:' , 'http:'), - `poll` = REPLACE(`poll` , 'https:' , 'http:'), - `confirm` = REPLACE(`confirm`, 'https:' , 'http:'), - `poco` = REPLACE(`poco` , 'https:' , 'http:') - WHERE `self` = 1" - ); - DBA::e("UPDATE `profile` SET - `photo` = REPLACE(`photo` , 'https:' , 'http:'), - `thumb` = REPLACE(`thumb` , 'https:' , 'http:') - WHERE 1 " - ); - } - } - $transactionConfig->set('system', 'ssl_policy' , $ssl_policy); + $transactionConfig->set('system', 'maxloadavg' , $maxloadavg); $transactionConfig->set('system', 'min_memory' , $min_memory); $transactionConfig->set('system', 'optimize_tables' , $optimize_tables); @@ -408,12 +368,6 @@ class Site extends BaseAdmin Register::OPEN => DI::l10n()->t('Open') ]; - $ssl_choices = [ - App\BaseURL::SSL_POLICY_NONE => DI::l10n()->t('No SSL policy, links will track page SSL state'), - App\BaseURL::SSL_POLICY_FULL => DI::l10n()->t('Force all links to use SSL'), - App\BaseURL::SSL_POLICY_SELFSIGN => DI::l10n()->t('Self-signed certificate, use SSL for local links only (discouraged)') - ]; - $check_git_version_choices = [ 'none' => DI::l10n()->t('Don\'t check'), 'stable' => DI::l10n()->t('check the stable version'), @@ -428,7 +382,7 @@ class Site extends BaseAdmin // ContactRelation::DISCOVERY_ALL => DI::l10n()->t('All'), ]; - $diaspora_able = (DI::baseUrl()->getUrlPath() == ''); + $diaspora_able = (DI::baseUrl()->getPath() == ''); $t = Renderer::getMarkupTemplate('admin/site.tpl'); return Renderer::replaceMacros($t, [ @@ -452,7 +406,6 @@ class Site extends BaseAdmin '$relocate' => DI::l10n()->t('Relocate Node'), '$relocate_msg' => DI::l10n()->t('Relocating your node enables you to change the DNS domain of this node and keep all the existing users and posts. This process takes a while and can only be started from the relocate console command like this:'), '$relocate_cmd' => DI::l10n()->t('(Friendica directory)# bin/console relocate https://newdomain.com'), - '$baseurl' => DI::baseUrl()->get(true), // name, label, value, help string, extra data... '$sitename' => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''], @@ -464,9 +417,8 @@ class Site extends BaseAdmin '$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')], '$additional_info' => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())], '$language' => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), '', $lang_choices], - '$theme' => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - Change default theme settings', DI::baseUrl()->get(true) . '/admin/themes'), $theme_choices], + '$theme' => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - Change default theme settings', DI::baseUrl() . '/admin/themes'), $theme_choices], '$theme_mobile' => ['theme_mobile', DI::l10n()->t('Mobile system theme'), DI::config()->get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile], - '$ssl_policy' => ['ssl_policy', DI::l10n()->t('SSL link policy'), DI::config()->get('system', 'ssl_policy'), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices], '$force_ssl' => ['force_ssl', DI::l10n()->t('Force SSL'), DI::config()->get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')], '$show_help' => ['show_help', DI::l10n()->t('Show help entry from navigation menu'), !DI::config()->get('system', 'hide_help'), DI::l10n()->t('Displays the menu entry for the Help pages from the navigation menu. It is always accessible by calling /help directly.')], '$singleuser' => ['singleuser', DI::l10n()->t('Single user instance'), DI::config()->get('system', 'singleuser', '---'), DI::l10n()->t('Make this instance multi-user or single-user for the named user'), $user_names], diff --git a/src/Module/Admin/Storage.php b/src/Module/Admin/Storage.php index ead4f6d83..71d34cb25 100644 --- a/src/Module/Admin/Storage.php +++ b/src/Module/Admin/Storage.php @@ -144,7 +144,6 @@ class Storage extends BaseAdmin '$use' => DI::l10n()->t('Use storage backend'), '$save_reload' => DI::l10n()->t('Save & Reload'), '$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'), - '$baseurl' => DI::baseUrl()->get(true), '$form_security_token' => self::getFormSecurityToken("admin_storage"), '$storagebackend' => $current_storage_backend instanceof ICanWriteToStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'), '$availablestorageforms' => $available_storage_forms, diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index b4ea14cf0..d872f4825 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -98,6 +98,10 @@ class Summary extends BaseAdmin $warningtext[] = DI::l10n()->t('The last update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear. (Some of the errors are possibly inside the logfile.)'); } + if (empty(DI::config()->get('system', 'url'))) { + $warningtext[] = DI::l10n()->t('The system.url entry is missing. This is a low level setting and can lead to unexpected behavior. Please add a valid entry as soon as possible in the config file or per console command!'); + } + $last_worker_call = DI::keyValue()->get('last_worker_execution'); if (!$last_worker_call) { $warningtext[] = DI::l10n()->t('The worker was never executed. Please check your database structure!'); @@ -107,18 +111,18 @@ class Summary extends BaseAdmin // Legacy config file warning if (file_exists('.htconfig.php')) { - $warningtext[] = DI::l10n()->t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from .htconfig.php. See the Config help page for help with the transition.', DI::baseUrl()->get() . '/help/Config'); + $warningtext[] = DI::l10n()->t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from .htconfig.php. See the Config help page for help with the transition.', DI::baseUrl() . '/help/Config'); } if (file_exists('config/local.ini.php')) { - $warningtext[] = DI::l10n()->t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from config/local.ini.php. See the Config help page for help with the transition.', DI::baseUrl()->get() . '/help/Config'); + $warningtext[] = DI::l10n()->t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from config/local.ini.php. See the Config help page for help with the transition.', DI::baseUrl() . '/help/Config'); } // Check server vitality if (!self::checkSelfHostMeta()) { - $well_known = DI::baseUrl()->get() . Probe::HOST_META; + $well_known = DI::baseUrl() . Probe::HOST_META; $warningtext[] = DI::l10n()->t('%s is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See the installation page for help.', - $well_known, $well_known, DI::baseUrl()->get() . '/help/Install'); + $well_known, $well_known, DI::baseUrl() . '/help/Install'); } // Check logfile permission @@ -229,7 +233,7 @@ class Summary extends BaseAdmin private static function checkSelfHostMeta() { // Fetch the host-meta to check if this really is a vital server - return DI::httpClient()->get(DI::baseUrl()->get() . Probe::HOST_META, HttpClientAccept::XRD_XML)->isSuccess(); + return DI::httpClient()->get(DI::baseUrl() . Probe::HOST_META, HttpClientAccept::XRD_XML)->isSuccess(); } } diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php index e3ba26e4a..7648b6b97 100644 --- a/src/Module/Admin/Themes/Details.php +++ b/src/Module/Admin/Themes/Details.php @@ -76,7 +76,7 @@ class Details extends BaseAdmin require_once "view/theme/$theme/config.php"; if (function_exists('theme_admin')) { - $admin_form = ''; + $admin_form = ''; } } @@ -91,7 +91,6 @@ class Details extends BaseAdmin '$page' => DI::l10n()->t('Themes'), '$toggle' => DI::l10n()->t('Toggle'), '$settings' => DI::l10n()->t('Settings'), - '$baseurl' => DI::baseUrl()->get(true), '$addon' => $theme, '$status' => $status, '$action' => $action, diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 1a7dda325..389f82941 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -95,7 +95,7 @@ class Embed extends BaseAdmin $t = Renderer::getMarkupTemplate('admin/addons/embed.tpl'); return Renderer::replaceMacros($t, [ - '$action' => DI::baseUrl()->get(true) . '/admin/themes/' . $theme . '/embed?mode=minimal', + '$action' => 'admin/themes/' . $theme . '/embed?mode=minimal', '$form' => $admin_form, '$form_security_token' => self::getFormSecurityToken("admin_theme_settings"), ]); diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php index 9ffe2ca8f..c74297744 100644 --- a/src/Module/Admin/Themes/Index.php +++ b/src/Module/Admin/Themes/Index.php @@ -112,7 +112,6 @@ class Index extends BaseAdmin '$page' => DI::l10n()->t('Themes'), '$submit' => DI::l10n()->t('Save Settings'), '$reload' => DI::l10n()->t('Reload active themes'), - '$baseurl' => DI::baseUrl()->get(true), '$function' => 'themes', '$addons' => $addons, '$pcount' => count($themes), diff --git a/src/Module/Api/GNUSocial/GNUSocial/Config.php b/src/Module/Api/GNUSocial/GNUSocial/Config.php index 94d155cda..5a8f6aad3 100644 --- a/src/Module/Api/GNUSocial/GNUSocial/Config.php +++ b/src/Module/Api/GNUSocial/GNUSocial/Config.php @@ -37,9 +37,9 @@ class Config extends BaseApi $config = [ 'site' => [ 'name' => DI::config()->get('config', 'sitename'), - 'server' => DI::baseUrl()->getHostname(), + 'server' => DI::baseUrl()->getHost(), 'theme' => DI::config()->get('system', 'theme'), - 'path' => DI::baseUrl()->getUrlPath(), + 'path' => DI::baseUrl()->getPath(), 'logo' => DI::baseUrl() . '/images/friendica-64.png', 'fancy' => true, 'language' => DI::config()->get('system', 'language'), @@ -52,7 +52,7 @@ class Config extends BaseApi 'private' => (bool)DI::config()->get('system', 'block_public'), 'textlimit' => (string) DI::config()->get('config', 'api_import_size', DI::config()->get('config', 'max_import_size')), 'sslserver' => null, - 'ssl' => DI::config()->get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL ? 'always' : '0', + 'ssl' => DI::baseUrl()->getScheme() === 'https' ? 'always' : '0', 'friendica' => [ 'FRIENDICA_PLATFORM' => App::PLATFORM, 'FRIENDICA_VERSION' => App::VERSION, diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index c803835d1..01856b2d8 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -107,6 +107,7 @@ class Statuses extends BaseApi 'visibility' => '', // Visibility of the posted status. One of: "public", "unlisted", "private" or "direct". 'scheduled_at' => '', // ISO 8601 Datetime at which to schedule a status. Providing this paramter will cause ScheduledStatus to be returned instead of Status. Must be at least 5 minutes in the future. 'language' => '', // ISO 639 language code for this status. + 'friendica' => [], // Friendica extensions to the standard Mastodon API spec ], $request); $owner = User::getOwnerDataById($uid); @@ -208,8 +209,10 @@ class Statuses extends BaseApi $item['quote-uri-id'] = $request['quote_id']; } + $item['title'] = $request['friendica']['title'] ?? ''; + if (!empty($request['spoiler_text'])) { - if (!$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) { + if (!isset($request['friendica']['title']) && !$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) { $item['title'] = $request['spoiler_text']; } else { $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; diff --git a/src/Module/Api/Mastodon/Timelines/Direct.php b/src/Module/Api/Mastodon/Timelines/Direct.php index a5f1f97f3..82b96e698 100644 --- a/src/Module/Api/Mastodon/Timelines/Direct.php +++ b/src/Module/Api/Mastodon/Timelines/Direct.php @@ -65,6 +65,13 @@ class Direct extends BaseApi $params['order'] = ['uri-id']; } + if (!empty($uid)) { + $condition = DBA::mergeConditions( + $condition, + ["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`) AND `cid` = `parent-author-id`)", $uid] + ); + } + $mails = DBA::select('mail', ['id', 'uri-id'], $condition, $params); $statuses = []; diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index 083d9867e..968e34dbb 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -90,11 +90,6 @@ class PublicTimeline extends BaseApi $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); } - if (!empty($uid)) { - $condition = DBA::mergeConditions($condition, - ["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`) AND `cid` = `parent-author-id`)", $uid]); - } - $items = Post::selectPostsForUser($uid, ['uri-id'], $condition, $params); $display_quotes = self::appSupportsQuotes(); diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index 1d04dec62..64cd84366 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -104,6 +104,13 @@ class Tag extends BaseApi $params['order'] = ['uri-id']; } + if (!empty($uid)) { + $condition = DBA::mergeConditions( + $condition, + ["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`) AND `cid` = `parent-author-id`)", $uid] + ); + } + $items = DBA::select('tag-search-view', ['uri-id'], $condition, $params); $display_quotes = self::appSupportsQuotes(); diff --git a/src/Module/Api/Mastodon/Trends/Links.php b/src/Module/Api/Mastodon/Trends/Links.php index 5cf2ed471..bfb353147 100644 --- a/src/Module/Api/Mastodon/Trends/Links.php +++ b/src/Module/Api/Mastodon/Trends/Links.php @@ -41,6 +41,7 @@ class Links extends BaseApi { $request = $this->getRequest([ 'limit' => 10, // Maximum number of results to return. Defaults to 10. + 'offset' => 0, // Offset in set, Defaults to 0. ], $request); $condition = ["EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-view`.`uri-id` AND `type` = ? AND NOT `name` IS NULL AND NOT `description` IS NULL) AND NOT `private` AND `commented` > ? AND `created` > ?", @@ -48,13 +49,17 @@ class Links extends BaseApi $condition = DBA::mergeConditions($condition, ['network' => Protocol::FEDERATED]); $trending = []; - $statuses = Post::selectPostThread(['uri-id', 'total-comments', 'total-actors'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]); + $statuses = Post::selectPostThread(['uri-id', 'total-comments', 'total-actors'], $condition, ['limit' => [$request['offset'], $request['limit']], 'offset' => $request['offset'], 'order' => ['total-actors' => true]]); while ($status = Post::fetch($statuses)) { $history = [['day' => (string)time(), 'uses' => (string)$status['total-comments'], 'accounts' => (string)$status['total-actors']]]; $trending[] = DI::mstdnCard()->createFromUriId($status['uri-id'], $history)->toArray(); } DBA::close($statuses); + if (!empty($trending)) { + self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); + } + System::jsonExit($trending); } } diff --git a/src/Module/Api/Mastodon/Trends/Statuses.php b/src/Module/Api/Mastodon/Trends/Statuses.php index cf287e59c..884319aa4 100644 --- a/src/Module/Api/Mastodon/Trends/Statuses.php +++ b/src/Module/Api/Mastodon/Trends/Statuses.php @@ -44,6 +44,7 @@ class Statuses extends BaseApi $request = $this->getRequest([ 'limit' => 10, // Maximum number of results to return. Defaults to 10. + 'offset' => 0, // Offset in set, Defaults to 0. ], $request); $condition = ["NOT `private` AND `commented` > ? AND `created` > ?", DateTimeFormat::utc('now -1 day'), DateTimeFormat::utc('now -1 week')]; @@ -52,7 +53,7 @@ class Statuses extends BaseApi $display_quotes = self::appSupportsQuotes(); $trending = []; - $statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]); + $statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => [$request['offset'], $request['limit']], 'order' => ['total-actors' => true]]); while ($status = Post::fetch($statuses)) { try { $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes); @@ -62,6 +63,10 @@ class Statuses extends BaseApi } DBA::close($statuses); + if (!empty($trending)) { + self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); + } + System::jsonExit($trending); } } diff --git a/src/Module/Api/Mastodon/Trends/Tags.php b/src/Module/Api/Mastodon/Trends/Tags.php index 810ab002d..2190a2e3c 100644 --- a/src/Module/Api/Mastodon/Trends/Tags.php +++ b/src/Module/Api/Mastodon/Trends/Tags.php @@ -37,11 +37,18 @@ class Tags extends BaseApi protected function rawContent(array $request = []) { $request = $this->getRequest([ - 'limit' => 20, // Maximum number of results to return. Defaults to 10. + 'limit' => 20, // Maximum number of results to return. Defaults to 20. + 'offset' => 0, // Offset in set. Defaults to 0. + 'friendica_local' => false, // Whether to return local tag trends instead of global, defaults to false ], $request); $trending = []; - $tags = Tag::getGlobalTrendingHashtags(24, 20); + if ($request['friendica_local']) { + $tags = Tag::getLocalTrendingHashtags(24, $request['limit'], $request['offset']); + } else { + $tags = Tag::getGlobalTrendingHashtags(24, $request['limit'], $request['offset']); + } + foreach ($tags as $tag) { $tag['name'] = $tag['term']; $history = [['day' => (string)time(), 'uses' => (string)$tag['score'], 'accounts' => (string)$tag['authors']]]; @@ -49,6 +56,10 @@ class Tags extends BaseApi $trending[] = $hashtag->toArray(); } - System::jsonExit(array_slice($trending, 0, $request['limit'])); + if (!empty($trending)) { + self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); + } + + System::jsonExit($trending); } } diff --git a/src/Module/Api/Twitter/ContactEndpoint.php b/src/Module/Api/Twitter/ContactEndpoint.php index d68f1a403..a338d3ce7 100644 --- a/src/Module/Api/Twitter/ContactEndpoint.php +++ b/src/Module/Api/Twitter/ContactEndpoint.php @@ -62,7 +62,7 @@ abstract class ContactEndpoint extends BaseApi if (!$screen_name) { $contact = Contact::getById($contact_id, ['nick', 'url']); // We don't have the followers of remote accounts so we check for locality - if (empty($contact) || !Strings::startsWith($contact['url'], DI::baseUrl()->get())) { + if (empty($contact) || !Strings::startsWith($contact['url'], DI::baseUrl())) { throw new HTTPException\NotFoundException(DI::l10n()->t('Contact not found')); } diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 6a4119847..f8524b524 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -168,6 +168,34 @@ class BaseApi extends BaseModule return 'Link: <' . $next . '>; rel="next", <' . $prev . '>; rel="prev"'; } + /** + * Get the "link" header with "next" and "prev" links for an offset/limit type call + * @return string + */ + protected static function getOffsetAndLimitLinkHeader(int $offset, int $limit): string + { + $request = self::$request; + + unset($request['offset']); + $request['limit'] = $limit; + + $prev_request = $next_request = $request; + + $prev_request['offset'] = $offset - $limit; + $next_request['offset'] = $offset + $limit; + + $command = DI::baseUrl() . '/' . DI::args()->getCommand(); + + $prev = $command . '?' . http_build_query($prev_request); + $next = $command . '?' . http_build_query($next_request); + + if ($prev_request['offset'] >= 0) { + return 'Link: <' . $next . '>; rel="next", <' . $prev . '>; rel="prev"'; + } else { + return 'Link: <' . $next . '>; rel="next"'; + } + } + /** * Set the "link" header with "next" and "prev" links * @return void @@ -180,6 +208,18 @@ class BaseApi extends BaseModule } } + /** + * Set the "link" header with "next" and "prev" links + * @return void + */ + protected static function setLinkHeaderByOffsetLimit(int $offset, int $limit) + { + $header = self::getOffsetAndLimitLinkHeader($offset, $limit); + if (!empty($header)) { + header($header); + } + } + /** * Check if the app is known to support quoted posts * diff --git a/src/Module/Blocklist/Domain/Download.php b/src/Module/Blocklist/Domain/Download.php index 3a6e9439b..2f367a0aa 100644 --- a/src/Module/Blocklist/Domain/Download.php +++ b/src/Module/Blocklist/Domain/Download.php @@ -59,7 +59,7 @@ class Download extends \Friendica\BaseModule header('Content-Type: text/csv'); header('Content-Transfer-Encoding: Binary'); - header('Content-disposition: attachment; filename="' . $this->baseUrl->getHostname() . '_domain_blocklist_' . substr($hash, 0, 6) . '.csv"'); + header('Content-disposition: attachment; filename="' . $this->baseUrl->getHost() . '_domain_blocklist_' . substr($hash, 0, 6) . '.csv"'); header("Etag: $etag"); $this->blocklist->exportToFile('php://output'); diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php index d915fbf69..959ed71a8 100644 --- a/src/Module/Bookmarklet.php +++ b/src/Module/Bookmarklet.php @@ -47,7 +47,7 @@ class Bookmarklet extends BaseModule } $referer = Strings::normaliseLink($_SERVER['HTTP_REFERER'] ?? ''); - $page = Strings::normaliseLink(DI::baseUrl()->get() . "/bookmarklet"); + $page = Strings::normaliseLink(DI::baseUrl() . "/bookmarklet"); if (!strstr($referer, $page)) { if (empty($_REQUEST["url"])) { diff --git a/src/Module/Contact.php b/src/Module/Contact.php index bc2f2f402..a70db0234 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -220,7 +220,6 @@ class Contact extends BaseModule $tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl()->get(true), ]); $o = ''; diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index e13fbd584..34d02ac22 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -236,7 +236,6 @@ class Profile extends BaseModule $_SESSION['return_path'] = $this->args->getQueryString(); $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [ - '$baseurl' => $this->baseUrl->get(true), ]); switch ($localRelationship->rel) { diff --git a/src/Module/Contact/Redir.php b/src/Module/Contact/Redir.php index 5457b7442..678019755 100644 --- a/src/Module/Contact/Redir.php +++ b/src/Module/Contact/Redir.php @@ -166,7 +166,7 @@ class Redir extends \Friendica\BaseModule } if ($this->session->getRemoteUserId()) { - $host = substr($this->baseUrl->getUrlPath() . ($this->baseUrl->getUrlPath() ? '/' . $this->baseUrl->getUrlPath() : ''), strpos($this->baseUrl->getUrlPath(), '://') + 3); + $host = substr($this->baseUrl->getPath() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : ''), strpos($this->baseUrl->getPath(), '://') + 3); $remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1); // On a local instance we have to check if the local user has already authenticated diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php index b07658e5f..1d5d966ad 100644 --- a/src/Module/Debug/Localtime.php +++ b/src/Module/Debug/Localtime.php @@ -58,7 +58,7 @@ class Localtime extends BaseModule $output .= '

' . DI::l10n()->t('Converted localtime: %s', self::$mod_localtime) . '

'; } - $output .= '
'; + $output .= ''; $output .= '

' . DI::l10n()->t('Please select your timezone:') . '

'; $output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ); $output .= '
'; diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index 8f2a98a59..6e1259152 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -61,7 +61,7 @@ class Fetch extends BaseModule } $host = $parts["scheme"] . "://" . $parts["host"]; - if (Strings::normaliseLink($host) != Strings::normaliseLink(DI::baseUrl()->get())) { + if (Strings::normaliseLink($host) != Strings::normaliseLink(DI::baseUrl())) { $location = $host . "/fetch/" . DI::args()->getArgv()[1] . "/" . urlencode($guid); System::externalRedirect($location, 301); } diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php index bbcccd7da..2c669e886 100644 --- a/src/Module/Friendica.php +++ b/src/Module/Friendica.php @@ -71,7 +71,7 @@ class Friendica extends BaseModule } $tos = ($config->get('system', 'tosdisplay')) ? - DI::l10n()->t('Read about the Terms of Service of this node.', DI::baseUrl()->get()) : + DI::l10n()->t('Read about the Terms of Service of this node.', DI::baseUrl()) : ''; $blockList = $config->get('system', 'blocklist'); @@ -99,7 +99,7 @@ class Friendica extends BaseModule return Renderer::replaceMacros($tpl, [ 'about' => DI::l10n()->t('This is Friendica, version %s that is running at the web location %s. The database version is %s, the post update version is %s.', '' . App::VERSION . '', - DI::baseUrl()->get(), + DI::baseUrl(), '' . $config->get('system', 'build') . '/' . DB_UPDATE_VERSION . '', '' . $keyValue->get('post_update_version') . '/' . PostUpdate::VERSION . ''), 'friendica' => DI::l10n()->t('Please visit Friendi.ca to learn more about the Friendica project.'), @@ -151,7 +151,7 @@ class Friendica extends BaseModule if (!empty($administrator)) { $admin = [ 'name' => $administrator['username'], - 'profile' => DI::baseUrl()->get() . '/profile/' . $administrator['nickname'], + 'profile' => DI::baseUrl() . '/profile/' . $administrator['nickname'], ]; } @@ -172,7 +172,7 @@ class Friendica extends BaseModule $data = [ 'version' => App::VERSION, - 'url' => DI::baseUrl()->get(), + 'url' => DI::baseUrl(), 'addons' => $visible_addons, 'locked_features' => $locked_features, 'explicit_content' => intval($config->get('system', 'explicit_content', 0)), @@ -182,7 +182,7 @@ class Friendica extends BaseModule 'site_name' => $config->get('config', 'sitename'), 'platform' => strtolower(App::PLATFORM), 'info' => $config->get('config', 'info'), - 'no_scrape_url' => DI::baseUrl()->get() . '/noscrape', + 'no_scrape_url' => DI::baseUrl() . '/noscrape', ]; System::jsonExit($data); diff --git a/src/Module/HCard.php b/src/Module/HCard.php index a6edd5100..92627125a 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -66,15 +66,15 @@ class HCard extends BaseModule $baseUrl = DI::baseUrl(); - $uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : '')); + $uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHost() . ($baseUrl->getPath() ? '/' . $baseUrl->getPath() : '')); $page['htmlhead'] .= '' . "\r\n"; - $page['htmlhead'] .= '' . "\r\n"; - $page['htmlhead'] .= '' . "\r\n"; - header('Link: <' . $baseUrl->get() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); + $page['htmlhead'] .= '' . "\r\n"; + $page['htmlhead'] .= '' . "\r\n"; + header('Link: <' . $baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) { - $page['htmlhead'] .= "get() . "/dfrn_{$dfrn}/{$nickname}\" />\r\n"; + $page['htmlhead'] .= "\r\n"; } $block = (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()); diff --git a/src/Module/Help.php b/src/Module/Help.php index f0bd6aa9f..3212d2fe4 100644 --- a/src/Module/Help.php +++ b/src/Module/Help.php @@ -102,7 +102,7 @@ class Help extends BaseModule $idNum[$level] ++; - $href = DI::baseUrl()->get() . "/help/{$filename}#{$anchor}"; + $href = "help/{$filename}#{$anchor}"; $toc .= "
  • " . strip_tags($line) . "
  • "; $id = implode("_", array_slice($idNum, 1, $level)); $line = "" . $line; diff --git a/src/Module/Home.php b/src/Module/Home.php index 74cc88d30..fbba889a8 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -69,7 +69,7 @@ class Home extends BaseModule $customHome = $homeFilePath; if (file_exists($cssFilePath)) { - DI::page()['htmlhead'] .= ''; + DI::page()->registerStylesheet('home.css', 'all'); } } diff --git a/src/Module/Install.php b/src/Module/Install.php index c1c3cda35..abf760237 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -34,6 +34,7 @@ use Friendica\Util\BasePath; use Friendica\Util\Profiler; use Friendica\Util\Temporal; use Psr\Log\LoggerInterface; +use GuzzleHttp\Psr7\Uri; class Install extends BaseModule { @@ -73,7 +74,7 @@ class Install extends BaseModule /** @var App\Mode */ protected $mode; - public function __construct(App $app, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Core\Installer $installer, array $server, array $parameters = []) + public function __construct(App $app, BasePath $basePath, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Core\Installer $installer, array $server, array $parameters = []) { parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); @@ -94,12 +95,11 @@ class Install extends BaseModule // get basic installation information and save them to the config cache $configCache = $this->app->getConfigCache(); - $basePath = new BasePath($this->app->getBasePath()); $this->installer->setUpCache($configCache, $basePath->getPath()); // We overwrite current theme css, because during install we may not have a working mod_rewrite // so we may not have a css at all. Here we set a static css file for the install procedure pages - Renderer::$theme['stylesheet'] = $this->baseUrl->get() . '/view/install/style.css'; + Renderer::$theme['stylesheet'] = $this->baseUrl . '/view/install/style.css'; $this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; } @@ -117,19 +117,15 @@ class Install extends BaseModule case self::DATABASE_CONFIG: $this->checkSetting($configCache, $_POST, 'config', 'php_path'); - $this->checkSetting($configCache, $_POST, 'config', 'hostname'); - $this->checkSetting($configCache, $_POST, 'system', 'ssl_policy'); $this->checkSetting($configCache, $_POST, 'system', 'basepath'); - $this->checkSetting($configCache, $_POST, 'system', 'urlpath'); + $this->checkSetting($configCache, $_POST, 'system', 'url'); break; case self::SITE_SETTINGS: $this->checkSetting($configCache, $_POST, 'config', 'php_path'); - $this->checkSetting($configCache, $_POST, 'config', 'hostname'); - $this->checkSetting($configCache, $_POST, 'system', 'ssl_policy'); $this->checkSetting($configCache, $_POST, 'system', 'basepath'); - $this->checkSetting($configCache, $_POST, 'system', 'urlpath'); + $this->checkSetting($configCache, $_POST, 'system', 'url'); $this->checkSetting($configCache, $_POST, 'database', 'hostname', Core\Installer::DEFAULT_HOST); $this->checkSetting($configCache, $_POST, 'database', 'username', ''); @@ -146,10 +142,8 @@ class Install extends BaseModule case self::FINISHED: $this->checkSetting($configCache, $_POST, 'config', 'php_path'); - $this->checkSetting($configCache, $_POST, 'config', 'hostname'); - $this->checkSetting($configCache, $_POST, 'system', 'ssl_policy'); $this->checkSetting($configCache, $_POST, 'system', 'basepath'); - $this->checkSetting($configCache, $_POST, 'system', 'urlpath'); + $this->checkSetting($configCache, $_POST, 'system', 'url'); $this->checkSetting($configCache, $_POST, 'database', 'hostname', Core\Installer::DEFAULT_HOST); $this->checkSetting($configCache, $_POST, 'database', 'username', ''); @@ -198,9 +192,9 @@ class Install extends BaseModule case self::SYSTEM_CHECK: $php_path = $configCache->get('config', 'php_path'); - $status = $this->installer->checkEnvironment($this->baseUrl->get(), $php_path); + $status = $this->installer->checkEnvironment($this->baseUrl, $php_path); - $tpl = Renderer::getMarkupTemplate('install_checks.tpl'); + $tpl = Renderer::getMarkupTemplate('install/01_checks.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => $this->t('System check'), @@ -218,43 +212,31 @@ class Install extends BaseModule break; case self::BASE_CONFIG: - $ssl_choices = [ - App\BaseURL::SSL_POLICY_NONE => $this->t("No SSL policy, links will track page SSL state"), - App\BaseURL::SSL_POLICY_FULL => $this->t("Force all links to use SSL"), - App\BaseURL::SSL_POLICY_SELFSIGN => $this->t("Self-signed certificate, use SSL for local links only \x28discouraged\x29") - ]; + $baseUrl = $configCache->get('system', 'url') ? + new Uri($configCache->get('system', 'url')) : + $this->baseUrl; - $tpl = Renderer::getMarkupTemplate('install_base.tpl'); + $tpl = Renderer::getMarkupTemplate('install/02_base_config.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => $this->t('Base settings'), - '$ssl_policy' => ['system-ssl_policy', - $this->t("SSL link policy"), - $configCache->get('system', 'ssl_policy'), - $this->t("Determines whether generated links should be forced to use SSL"), - $ssl_choices], - '$hostname' => ['config-hostname', - $this->t('Host name'), - $configCache->get('config', 'hostname'), - $this->t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'), - $this->t('Required')], '$basepath' => ['system-basepath', $this->t("Base path to installation"), $configCache->get('system', 'basepath'), $this->t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."), $this->t('Required')], - '$urlpath' => ['system-urlpath', - $this->t('Sub path of the URL'), - $configCache->get('system', 'urlpath'), - $this->t('Overwrite this field in case the sub path determination isn\'t right, otherwise leave it as is. Leaving this field blank means the installation is at the base URL without sub path.'), - ''], + '$system_url' => ['system-url', + $this->t('The Friendica system URL'), + (string)$baseUrl, + $this->t("Overwrite this field in case the system URL determination isn't right, otherwise leave it as is."), + $this->t('Required')], '$php_path' => $configCache->get('config', 'php_path'), '$submit' => $this->t('Submit'), ]); break; case self::DATABASE_CONFIG: - $tpl = Renderer::getMarkupTemplate('install_db.tpl'); + $tpl = Renderer::getMarkupTemplate('install/03_database_config.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => $this->t('Database connection'), @@ -264,10 +246,8 @@ class Install extends BaseModule '$required' => $this->t('Required'), '$requirement_not_satisfied' => $this->t('Requirement not satisfied'), '$checks' => $this->installer->getChecks(), - '$hostname' => $configCache->get('config', 'hostname'), - '$ssl_policy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $configCache->get('system', 'basepath'), - '$urlpath' => $configCache->get('system', 'urlpath'), + '$system_url' => $configCache->get('system', 'url'), '$dbhost' => ['database-hostname', $this->t('Database Server Name'), $configCache->get('database', 'hostname'), @@ -299,16 +279,14 @@ class Install extends BaseModule /* Installed langs */ $lang_choices = $this->l10n->getAvailableLanguages(); - $tpl = Renderer::getMarkupTemplate('install_settings.tpl'); + $tpl = Renderer::getMarkupTemplate('install/04_site_settings.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$required' => $this->t('Required'), '$checks' => $this->installer->getChecks(), '$pass' => $this->t('Site settings'), - '$hostname' => $configCache->get('config', 'hostname'), - '$ssl_policy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $configCache->get('system', 'basepath'), - '$urlpath' => $configCache->get('system', 'urlpath'), + '$system_url' => $configCache->get('system', 'url'), '$dbhost' => $configCache->get('database', 'hostname'), '$dbuser' => $configCache->get('database', 'username'), '$dbpass' => $configCache->get('database', 'password'), @@ -341,7 +319,7 @@ class Install extends BaseModule $db_return_text .= $txt; } - $tpl = Renderer::getMarkupTemplate('install_finished.tpl'); + $tpl = Renderer::getMarkupTemplate('install/05_finished.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$required' => $this->t('Required'), @@ -365,7 +343,7 @@ class Install extends BaseModule */ private function whatNext(): string { - $baseurl = $this->baseUrl->get(); + $baseurl = $this->baseUrl; return $this->t('

    What next

    ') . "

    " . $this->t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') diff --git a/src/Module/Invite.php b/src/Module/Invite.php index deefc44bb..3230dfa35 100644 --- a/src/Module/Invite.php +++ b/src/Module/Invite.php @@ -149,14 +149,14 @@ class Invite extends BaseModule if ($config->get('config', 'register_policy') === Register::CLOSED) { $linkTxt = DI::l10n()->t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirLocation . '/servers'); } else { - $linkTxt = DI::l10n()->t('To accept this invitation, please visit and register at %s or any other public Friendica website.', DI::baseUrl()->get()) + $linkTxt = DI::l10n()->t('To accept this invitation, please visit and register at %s or any other public Friendica website.', DI::baseUrl()) . "\r\n" . "\r\n" . DI::l10n()->t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirLocation . '/servers'); } } else { // there is no global directory URL defined if ($config->get('config', 'register_policy') === Register::CLOSED) { return DI::l10n()->t('Our apologies. This system is not currently configured to connect with other public sites or invite members.'); } else { - $linkTxt = DI::l10n()->t('To accept this invitation, please visit and register at %s.', DI::baseUrl()->get() + $linkTxt = DI::l10n()->t('To accept this invitation, please visit and register at %s.', DI::baseUrl() . "\r\n" . "\r\n" . DI::l10n()->t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks.')); } } @@ -172,7 +172,7 @@ class Invite extends BaseModule DI::l10n()->t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linkTxt . "\r\n" . "\r\n" . (($inviteOnly) ? DI::l10n()->t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . DI::l10n()->t('Once you have registered, please connect with me via my profile page at:') - . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getLoggedInUserNickname() + . "\r\n" . "\r\n" . DI::baseUrl() . '/profile/' . $app->getLoggedInUserNickname() . "\r\n" . "\r\n" . DI::l10n()->t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n", ], '$submit' => DI::l10n()->t('Submit') diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 8fa67ec97..1012dc72b 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -88,7 +88,7 @@ class Magic extends BaseModule $contact = $this->dba->selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]); // Redirect if the contact is already authenticated on this site. - if ($this->app->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl->get())) !== false) { + if ($this->app->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl)) !== false) { $this->logger->info('Contact is already authenticated'); System::externalRedirect($dest); } @@ -113,7 +113,7 @@ class Magic extends BaseModule $header = HTTPSignature::createSig( $header, $user['prvkey'], - 'acct:' . $user['nickname'] . '@' . $this->baseUrl->getHostname() . ($this->baseUrl->getUrlPath() ? '/' . $this->baseUrl->getUrlPath() : '') + 'acct:' . $user['nickname'] . '@' . $this->baseUrl->getHost() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : '') ); // Try to get an authentication token from the other instance. diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php index 4148b0ddf..e98c83a61 100644 --- a/src/Module/Manifest.php +++ b/src/Module/Manifest.php @@ -35,7 +35,7 @@ class Manifest extends BaseModule $manifest = [ 'name' => $config->get('config', 'sitename', 'Friendica'), - 'start_url' => DI::baseUrl()->get(), + 'start_url' => DI::baseUrl(), 'display' => 'standalone', 'description' => $config->get('config', 'info', DI::l10n()->t('A Decentralized Social Network')), 'short_name' => 'Friendica', @@ -74,12 +74,12 @@ class Manifest extends BaseModule if($touch_icon){ $manifest['icons'] = [ [ - 'src' => DI::baseUrl()->get() . '/' . $touch_icon, + 'src' => DI::baseUrl() . '/' . $touch_icon, 'sizes' => '192x192', 'type' => 'image/png', ], [ - 'src' => DI::baseUrl()->get() . '/' . $touch_icon, + 'src' => DI::baseUrl() . '/' . $touch_icon, 'sizes' => '512x512', 'type' => 'image/png', ], @@ -87,37 +87,37 @@ class Manifest extends BaseModule } else { $manifest['icons'] = [ [ - 'src' => DI::baseUrl()->get() . '/images/friendica.svg', + 'src' => DI::baseUrl() . '/images/friendica.svg', 'sizes' => 'any', 'type' => 'image/svg+xml', 'purpose' => 'any', ], [ - 'src' => DI::baseUrl()->get() . '/images/friendica-192.png', + 'src' => DI::baseUrl() . '/images/friendica-192.png', 'sizes' => '192x192', 'type' => 'image/png', 'purpose' => 'any', ], [ - 'src' => DI::baseUrl()->get() . '/images/friendica-512.png', + 'src' => DI::baseUrl() . '/images/friendica-512.png', 'sizes' => '512x512', 'type' => 'image/png', 'purpose' => 'any', ], [ - 'src' => DI::baseUrl()->get() . '/images/friendica-maskable.svg', + 'src' => DI::baseUrl() . '/images/friendica-maskable.svg', 'sizes' => 'any', 'type' => 'image/svg+xml', 'purpose' => 'maskable', ], [ - 'src' => DI::baseUrl()->get() . '/images/friendica-maskable-192.png', + 'src' => DI::baseUrl() . '/images/friendica-maskable-192.png', 'sizes' => '192x192', 'type' => 'image/png', 'purpose' => 'maskable', ], [ - 'src' => DI::baseUrl()->get() . '/images/friendica-maskable-512.png', + 'src' => DI::baseUrl() . '/images/friendica-maskable-512.png', 'sizes' => '512x512', 'type' => 'image/png', 'purpose' => 'maskable', diff --git a/src/Module/Moderation/Blocklist/Contact.php b/src/Module/Moderation/Blocklist/Contact.php index 2303906da..9c0a4a2d0 100644 --- a/src/Module/Moderation/Blocklist/Contact.php +++ b/src/Module/Moderation/Blocklist/Contact.php @@ -124,7 +124,7 @@ class Contact extends BaseModeration '$form_security_token' => self::getFormSecurityToken('moderation_contactblock'), // values // - '$baseurl' => $this->baseUrl->get(true), + '$baseurl' => $this->baseUrl, '$contacts' => $contacts, '$total_contacts' => $this->tt('%s total blocked contact', '%s total blocked contacts', $total), diff --git a/src/Module/Moderation/Blocklist/Server/Add.php b/src/Module/Moderation/Blocklist/Server/Add.php index 7a7d3dacf..864e1e036 100644 --- a/src/Module/Moderation/Blocklist/Server/Add.php +++ b/src/Module/Moderation/Blocklist/Server/Add.php @@ -138,7 +138,7 @@ class Add extends BaseModeration '$newreason' => ['reason', $this->t('Block reason'), $request['reason'] ?? '', $this->t('The reason why you blocked this server domain pattern. This reason will be shown publicly in the server information page.'), $this->t('Required'), '', ''], '$pattern' => $pattern, '$gservers' => $gservers, - '$baseurl' => $this->baseUrl->get(true), + '$baseurl' => $this->baseUrl, '$form_security_token' => self::getFormSecurityToken('moderation_blocklist_add') ]); } diff --git a/src/Module/Moderation/Blocklist/Server/Import.php b/src/Module/Moderation/Blocklist/Server/Import.php index 62086e7cc..dee2b87e3 100644 --- a/src/Module/Moderation/Blocklist/Server/Import.php +++ b/src/Module/Moderation/Blocklist/Server/Import.php @@ -130,7 +130,7 @@ class Import extends \Friendica\Module\BaseModeration '$mode_append' => ['mode', $this->t('Append'), 'append', $this->t('Imports patterns from the file that weren\'t already existing in the current blocklist.'), 'checked="checked"'], '$mode_replace' => ['mode', $this->t('Replace'), 'replace', $this->t('Replaces the current blocklist by the imported patterns.')], '$blocklist' => $this->blocklist, - '$baseurl' => $this->baseUrl->get(true), + '$baseurl' => $this->baseUrl, '$form_security_token' => self::getFormSecurityToken('moderation_blocklist_import') ]); } diff --git a/src/Module/Moderation/Blocklist/Server/Index.php b/src/Module/Moderation/Blocklist/Server/Index.php index b52641c67..f5ef428a8 100644 --- a/src/Module/Moderation/Blocklist/Server/Index.php +++ b/src/Module/Moderation/Blocklist/Server/Index.php @@ -115,7 +115,7 @@ class Index extends BaseModeration '$listfile' => ['listfile', $this->t('Server domain pattern blocklist CSV file'), '', '', $this->t('Required'), '', 'file'], '$newdomain' => ['pattern', $this->t('Server Domain Pattern'), '', $this->t('The domain pattern of the new server to add to the blocklist. Do not include the protocol.'), $this->t('Required'), '', ''], '$entries' => $blocklistform, - '$baseurl' => $this->baseUrl->get(true), + '$baseurl' => $this->baseUrl, '$form_security_token' => self::getFormSecurityToken('moderation_blocklist'), '$form_security_token_import' => self::getFormSecurityToken('moderation_blocklist_import'), diff --git a/src/Module/Moderation/Users/Active.php b/src/Module/Moderation/Users/Active.php index 4e6b17bfa..c4805b7b0 100644 --- a/src/Module/Moderation/Users/Active.php +++ b/src/Module/Moderation/Users/Active.php @@ -32,7 +32,7 @@ class Active extends BaseUsers { $this->checkModerationAccess(); - self::checkFormSecurityTokenRedirectOnError($this->baseUrl->get(true), 'moderation_users_active'); + self::checkFormSecurityTokenRedirectOnError($this->baseUrl, 'moderation_users_active'); $users = $request['user'] ?? []; @@ -150,7 +150,7 @@ class Active extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users_active'), // values // - '$baseurl' => $this->baseUrl->get(true), + '$baseurl' => $this->baseUrl, '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Blocked.php b/src/Module/Moderation/Users/Blocked.php index 5fac107f0..8600dc05c 100644 --- a/src/Module/Moderation/Users/Blocked.php +++ b/src/Module/Moderation/Users/Blocked.php @@ -149,7 +149,6 @@ class Blocked extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users_blocked'), // values // - '$baseurl' => $this->baseUrl->get(true), '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Create.php b/src/Module/Moderation/Users/Create.php index 1c8a5cb05..75792541e 100644 --- a/src/Module/Moderation/Users/Create.php +++ b/src/Module/Moderation/Users/Create.php @@ -65,7 +65,6 @@ class Create extends BaseUsers '$form_security_token' => self::getFormSecurityToken('admin_users_create'), // values // - '$baseurl' => $this->baseUrl->get(true), '$query_string' => $this->args->getQueryString(), '$newusername' => ['new_user_name', $this->t('Name'), '', $this->t('Name of the new user.')], diff --git a/src/Module/Moderation/Users/Deleted.php b/src/Module/Moderation/Users/Deleted.php index 6989af98b..58a29ed55 100644 --- a/src/Module/Moderation/Users/Deleted.php +++ b/src/Module/Moderation/Users/Deleted.php @@ -85,7 +85,6 @@ class Deleted extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users_deleted'), // values // - '$baseurl' => $this->baseUrl->get(true), '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Index.php b/src/Module/Moderation/Users/Index.php index 5457917db..d517ab9dd 100644 --- a/src/Module/Moderation/Users/Index.php +++ b/src/Module/Moderation/Users/Index.php @@ -83,7 +83,7 @@ class Index extends BaseUsers switch ($action) { case 'delete': if ($this->session->getLocalUserId() != $uid) { - self::checkFormSecurityTokenRedirectOnError($this->baseUrl->get(true), 'moderation_users', 't'); + self::checkFormSecurityTokenRedirectOnError($this->baseUrl, 'moderation_users', 't'); // delete user User::remove($uid); @@ -168,7 +168,6 @@ class Index extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users'), // values // - '$baseurl' => $this->baseUrl->get(true), '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Pending.php b/src/Module/Moderation/Users/Pending.php index f3fc26822..d0fb7b8d1 100644 --- a/src/Module/Moderation/Users/Pending.php +++ b/src/Module/Moderation/Users/Pending.php @@ -105,7 +105,6 @@ class Pending extends BaseUsers '$form_security_token' => self::getFormSecurityToken('admin_users_pending'), // values // - '$baseurl' => $this->baseUrl->get(true), '$query_string' => $this->args->getQueryString(), '$pending' => $pending, diff --git a/src/Module/NodeInfo210.php b/src/Module/NodeInfo210.php index 98f114fb3..e7112846c 100644 --- a/src/Module/NodeInfo210.php +++ b/src/Module/NodeInfo210.php @@ -52,7 +52,6 @@ class NodeInfo210 extends BaseModule $nodeinfo = [ 'version' => '1.0', 'server' => [ - 'baseUrl' => $this->baseUrl->get(), 'name' => $this->config->get('config', 'sitename'), 'software' => 'friendica', 'version' => App::VERSION . '-' . DB_UPDATE_VERSION, diff --git a/src/Module/Notifications/Ping.php b/src/Module/Notifications/Ping.php index 15c775d20..3cd4d7020 100644 --- a/src/Module/Notifications/Ping.php +++ b/src/Module/Notifications/Ping.php @@ -244,7 +244,7 @@ class Ping extends BaseModule $registration['url'], $this->l10n->t('{0} requested registration'), new \DateTime($registration['created'], new \DateTimeZone('UTC')), - new Uri($this->baseUrl->get(true) . '/moderation/users/pending') + new Uri($this->baseUrl . '/moderation/users/pending') ); } } else { @@ -253,7 +253,7 @@ class Ping extends BaseModule $registrations[0]['url'], $this->l10n->t('{0} and %d others requested registration', count($registrations) - 1), new \DateTime($registrations[0]['created'], new \DateTimeZone('UTC')), - new Uri($this->baseUrl->get(true) . '/moderation/users/pending') + new Uri($this->baseUrl . '/moderation/users/pending') ); } diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index 36e8713d9..f01baafad 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -39,8 +39,8 @@ class OpenSearch extends BaseModule */ protected function rawContent(array $request = []) { - $hostname = DI::baseUrl()->getHostname(); - $baseUrl = DI::baseUrl()->get(); + $hostname = DI::baseUrl()->getHost(); + $baseUrl = DI::baseUrl(); /** @var DOMDocument $xml */ XML::fromArray([ diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php index 92ab321b8..6fb44c300 100644 --- a/src/Module/Profile/Profile.php +++ b/src/Module/Profile/Profile.php @@ -352,7 +352,7 @@ class Profile extends BaseProfile $htmlhead .= '' . "\n"; $htmlhead .= '' . "\n"; $htmlhead .= '' . "\n"; - $uri = urlencode('acct:' . $profile['nickname'] . '@' . $this->baseUrl->getHostname() . ($this->baseUrl->getUrlPath() ? '/' . $this->baseUrl->getUrlPath() : '')); + $uri = urlencode('acct:' . $profile['nickname'] . '@' . $this->baseUrl->getHost() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : '')); $htmlhead .= '' . "\n"; header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); diff --git a/src/Module/Profile/Schedule.php b/src/Module/Profile/Schedule.php index b6d5fa182..ef57c294a 100644 --- a/src/Module/Profile/Schedule.php +++ b/src/Module/Profile/Schedule.php @@ -78,7 +78,6 @@ class Schedule extends BaseProfile $tpl = Renderer::getMarkupTemplate('profile/schedule.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"), - '$baseurl' => DI::baseUrl()->get(true), '$title' => DI::l10n()->t('Scheduled Posts'), '$nickname' => $this->parameters['nickname'] ?? '', '$scheduled_at' => DI::l10n()->t('Scheduled'), diff --git a/src/Module/Profile/UnkMail.php b/src/Module/Profile/UnkMail.php index 8fd64a17a..4b38d2037 100644 --- a/src/Module/Profile/UnkMail.php +++ b/src/Module/Profile/UnkMail.php @@ -141,7 +141,6 @@ class UnkMail extends \Friendica\BaseModule $tpl = Renderer::getMarkupTemplate('profile/unkmail-header.tpl'); $this->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => $this->baseUrl->get(true), '$nickname' => $user['nickname'], '$linkurl' => $this->l10n->t('Please enter a link URL:') ]); diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php index d76094003..6d608063e 100644 --- a/src/Module/ReallySimpleDiscovery.php +++ b/src/Module/ReallySimpleDiscovery.php @@ -48,7 +48,7 @@ class ReallySimpleDiscovery extends BaseModule '@attributes' => [ 'name' => 'Twitter', 'preferred' => 'true', - 'apiLink' => DI::baseUrl()->get(), + 'apiLink' => DI::baseUrl(), 'blogID' => '', ], 'settings' => [ diff --git a/src/Module/Register.php b/src/Module/Register.php index 6b21a0c7e..e5c5840d2 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -161,7 +161,7 @@ class Register extends BaseModule '$ask_password' => $ask_password, '$password1' => ['password1', DI::l10n()->t('New Password:'), '', DI::l10n()->t('Leave empty for an auto generated password.')], '$password2' => ['confirm', DI::l10n()->t('Confirm:'), '', ''], - '$nickdesc' => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "nickname@%s".', DI::baseUrl()->getHostname()), + '$nickdesc' => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "nickname@%s".', DI::baseUrl()->getHost()), '$nicklabel' => DI::l10n()->t('Choose a nickname: '), '$photo' => $photo, '$publish' => $profile_publish, @@ -169,7 +169,7 @@ class Register extends BaseModule '$username' => $username, '$email' => $email, '$nickname' => $nickname, - '$sitename' => DI::baseUrl()->getHostname(), + '$sitename' => DI::baseUrl()->getHost(), '$importh' => DI::l10n()->t('Import'), '$importt' => DI::l10n()->t('Import your profile to this friendica instance'), '$showtoslink' => DI::config()->get('system', 'tosdisplay'), @@ -298,7 +298,7 @@ class Register extends BaseModule $user = $result['user']; - $base_url = DI::baseUrl()->get(); + $base_url = DI::baseUrl(); if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) { $url = $base_url . '/profile/' . $user['nickname']; @@ -404,11 +404,11 @@ class Register extends BaseModule 'type' => Model\Notification\Type::SYSTEM, 'event' => $event, 'uid' => $admin['uid'], - 'link' => DI::baseUrl()->get(true) . '/moderation/users/', + 'link' => DI::baseUrl() . '/moderation/users/', 'source_name' => $user['username'], 'source_mail' => $user['email'], 'source_nick' => $user['nickname'], - 'source_link' => DI::baseUrl()->get(true) . '/moderation/users/', + 'source_link' => DI::baseUrl() . '/moderation/users/', 'source_photo' => User::getAvatarUrl($user, Proxy::SIZE_THUMB), 'show_in_notification_page' => false ]); diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php index d1da83b2c..c5028ffc5 100644 --- a/src/Module/Security/Login.php +++ b/src/Module/Security/Login.php @@ -132,7 +132,6 @@ class Login extends BaseModule DI::page()['htmlhead'] .= Renderer::replaceMacros( Renderer::getMarkupTemplate('login_head.tpl'), [ - '$baseurl' => DI::baseUrl()->get(true) ] ); @@ -154,7 +153,7 @@ class Login extends BaseModule $o = Renderer::replaceMacros( $tpl, [ - '$dest_url' => DI::baseUrl()->get(true) . '/login', + '$dest_url' => DI::baseUrl() . '/login', '$logout' => DI::l10n()->t('Logout'), '$login' => DI::l10n()->t('Login'), diff --git a/src/Module/Security/OpenID.php b/src/Module/Security/OpenID.php index b3f869e2f..e0a13954d 100644 --- a/src/Module/Security/OpenID.php +++ b/src/Module/Security/OpenID.php @@ -43,7 +43,7 @@ class OpenID extends BaseModule if (!empty($_GET['openid_mode']) && !empty($session->get('openid'))) { - $openid = new LightOpenID(DI::baseUrl()->getHostname()); + $openid = new LightOpenID(DI::baseUrl()->getHost()); $l10n = DI::l10n(); @@ -82,7 +82,7 @@ class OpenID extends BaseModule $session->set('openid_identity', $authId); // Detect the server URL - $open_id_obj = new LightOpenID(DI::baseUrl()->getHostname()); + $open_id_obj = new LightOpenID(DI::baseUrl()->getHost()); $open_id_obj->identity = $authId; $session->set('openid_server', $open_id_obj->discover($open_id_obj->identity)); diff --git a/src/Module/Security/PasswordTooLong.php b/src/Module/Security/PasswordTooLong.php index 53fafea41..eeeae4084 100644 --- a/src/Module/Security/PasswordTooLong.php +++ b/src/Module/Security/PasswordTooLong.php @@ -93,7 +93,6 @@ class PasswordTooLong extends \Friendica\BaseModule 'submit' => $this->l10n->t('Update Password'), ], - '$baseurl' => $this->baseUrl->get(true), '$form_security_token' => self::getFormSecurityToken('security/password_too_long'), '$return_url' => $request['return_url'] ?? '', diff --git a/src/Module/Settings/Account.php b/src/Module/Settings/Account.php index f8f65e720..cba12cc39 100644 --- a/src/Module/Settings/Account.php +++ b/src/Module/Settings/Account.php @@ -555,10 +555,9 @@ class Account extends BaseSettings $tpl = Renderer::getMarkupTemplate('settings/account.tpl'); $o = Renderer::replaceMacros($tpl, [ '$ptitle' => DI::l10n()->t('Account Settings'), - '$desc' => DI::l10n()->t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), DI::baseUrl() . '/profile/' . $nickname), + '$desc' => DI::l10n()->t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . DI::baseUrl()->getHost() . DI::baseUrl()->getPath(), DI::baseUrl() . '/profile/' . $nickname), '$submit' => DI::l10n()->t('Save Settings'), - '$baseurl' => DI::baseUrl()->get(true), '$uid' => DI::userSession()->getLocalUserId(), '$form_security_token' => self::getFormSecurityToken('settings'), '$open' => $this->parameters['open'] ?? 'password', diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index cb9ec09ee..d24a8e10d 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -252,7 +252,6 @@ class Display extends BaseSettings '$calendar_title' => $this->t('Calendar'), '$form_security_token' => self::getFormSecurityToken('settings_display'), - '$baseurl' => $this->baseUrl->get(true), '$uid' => $uid, '$theme' => ['theme', $this->t('Display Theme:'), $theme_selected, '', $themes, true], diff --git a/src/Module/Settings/OAuth.php b/src/Module/Settings/OAuth.php index 00f4075b0..98c547e1a 100644 --- a/src/Module/Settings/OAuth.php +++ b/src/Module/Settings/OAuth.php @@ -68,7 +68,6 @@ class OAuth extends BaseSettings $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl'); return Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseSettings::getFormSecurityToken('settings_oauth'), - '$baseurl' => $this->baseUrl->get(true), '$title' => $this->t('Connected Apps'), '$name' => $this->t('Name'), '$website' => $this->t('Home Page'), diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index 450be0331..4e3967ec1 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -208,7 +208,6 @@ class Index extends BaseSettings ]; DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/profile/index_head.tpl'), [ - '$baseurl' => DI::baseUrl()->get(true), ]); $personal_account = ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY); @@ -241,7 +240,7 @@ class Index extends BaseSettings '$lbl_profile_photo' => DI::l10n()->t('Upload Profile Photo'), - '$baseurl' => DI::baseUrl()->get(true), + '$baseurl' => DI::baseUrl(), '$nickname' => $profile['nickname'], '$name' => ['name', DI::l10n()->t('Display name:'), $profile['name']], '$about' => ['about', DI::l10n()->t('Description:'), $profile['about']], diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php index 512ff8dd0..75976ac36 100644 --- a/src/Module/WellKnown/HostMeta.php +++ b/src/Module/WellKnown/HostMeta.php @@ -46,14 +46,14 @@ class HostMeta extends BaseModule $config->set('system', 'site_pubkey', $res['pubkey']); } - $domain = DI::baseUrl()->get(); + $domain = DI::baseUrl(); XML::fromArray([ 'XRD' => [ '@attributes' => [ 'xmlns' => 'http://docs.oasis-open.org/ns/xri/xrd-1.0', ], - 'hm:Host' => DI::baseUrl()->getHostname(), + 'hm:Host' => DI::baseUrl()->getHost(), '1:link' => [ '@attributes' => [ 'rel' => 'lrdd', diff --git a/src/Module/WellKnown/NodeInfo.php b/src/Module/WellKnown/NodeInfo.php index e1c486c2e..9ae641d41 100644 --- a/src/Module/WellKnown/NodeInfo.php +++ b/src/Module/WellKnown/NodeInfo.php @@ -46,9 +46,9 @@ class NodeInfo extends BaseModule $nodeinfo = [ 'links' => [ ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0', - 'href' => DI::baseUrl()->get() . '/nodeinfo/1.0'], + 'href' => DI::baseUrl() . '/nodeinfo/1.0'], ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', - 'href' => DI::baseUrl()->get() . '/nodeinfo/2.0'], + 'href' => DI::baseUrl() . '/nodeinfo/2.0'], ] ]; diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php index 4ee495984..11835ec35 100644 --- a/src/Module/WellKnown/XSocialRelay.php +++ b/src/Module/WellKnown/XSocialRelay.php @@ -64,17 +64,17 @@ class XSocialRelay extends BaseModule 'tags' => $tagList, 'protocols' => [ 'activitypub' => [ - 'actor' => DI::baseUrl()->get() . '/friendica', - 'receive' => DI::baseUrl()->get() . '/inbox' + 'actor' => DI::baseUrl() . '/friendica', + 'receive' => DI::baseUrl() . '/inbox' ], 'dfrn' => [ - 'receive' => DI::baseUrl()->get() . '/dfrn_notify' + 'receive' => DI::baseUrl() . '/dfrn_notify' ] ] ]; if (DI::config()->get("system", "diaspora_enabled")) { - $relay['protocols']['diaspora'] = ['receive' => DI::baseUrl()->get() . '/receive/public']; + $relay['protocols']['diaspora'] = ['receive' => DI::baseUrl() . '/receive/public']; } System::jsonExit($relay); diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index ad2b25902..098d69e23 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -105,7 +105,7 @@ class Xrd extends BaseModule private function printSystemJSON(array $owner) { - $baseURL = $this->baseUrl->get(); + $baseURL = $this->baseUrl; $json = [ 'subject' => 'acct:' . $owner['addr'], 'aliases' => [$owner['url']], @@ -151,7 +151,7 @@ class Xrd extends BaseModule private function printJSON(string $alias, array $owner, array $avatar) { - $baseURL = $this->baseUrl->get(); + $baseURL = $this->baseUrl; $json = [ 'subject' => 'acct:' . $owner['addr'], @@ -228,7 +228,7 @@ class Xrd extends BaseModule private function printXML(string $alias, array $owner, array $avatar) { - $baseURL = $this->baseUrl->get(); + $baseURL = $this->baseUrl; $xmlString = XML::fromArray([ 'XRD' => [ diff --git a/src/Navigation/Notifications/Factory/FormattedNavNotification.php b/src/Navigation/Notifications/Factory/FormattedNavNotification.php index 638640321..b4e48172c 100644 --- a/src/Navigation/Notifications/Factory/FormattedNavNotification.php +++ b/src/Navigation/Notifications/Factory/FormattedNavNotification.php @@ -136,7 +136,7 @@ class FormattedNavNotification extends BaseFactory self::$contacts[$notification->actorId]['url'], $message['notification'], $notification->created, - new Uri($this->baseUrl->get() . '/notification/' . $notification->id), + new Uri($this->baseUrl . '/notification/' . $notification->id), $notification->seen, ); } @@ -168,7 +168,7 @@ class FormattedNavNotification extends BaseFactory self::$contacts[$intro->cid]['url'], $msg, $intro->datetime, - new Uri($this->baseUrl->get() . '/notifications/intros/' . $intro->id) + new Uri($this->baseUrl . '/notifications/intros/' . $intro->id) ); } } diff --git a/src/Navigation/Notifications/Factory/FormattedNotify.php b/src/Navigation/Notifications/Factory/FormattedNotify.php index aa2ff1d91..792bf91d3 100644 --- a/src/Navigation/Notifications/Factory/FormattedNotify.php +++ b/src/Navigation/Notifications/Factory/FormattedNotify.php @@ -90,7 +90,7 @@ class FormattedNotify extends BaseFactory case Activity::LIKE: return new ValueObject\FormattedNotify( 'like', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s liked %s's post", $formattedItem['author-name'], $formattedItem['parent-author-name']), @@ -102,7 +102,7 @@ class FormattedNotify extends BaseFactory case Activity::DISLIKE: return new ValueObject\FormattedNotify( 'dislike', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s disliked %s's post", $formattedItem['author-name'], $formattedItem['parent-author-name']), @@ -114,7 +114,7 @@ class FormattedNotify extends BaseFactory case Activity::ATTEND: return new ValueObject\FormattedNotify( 'attend', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s is attending %s's event", $formattedItem['author-name'], $formattedItem['parent-author-name']), @@ -126,7 +126,7 @@ class FormattedNotify extends BaseFactory case Activity::ATTENDNO: return new ValueObject\FormattedNotify( 'attendno', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s is not attending %s's event", $formattedItem['author-name'], $formattedItem['parent-author-name']), @@ -138,7 +138,7 @@ class FormattedNotify extends BaseFactory case Activity::ATTENDMAYBE: return new ValueObject\FormattedNotify( 'attendmaybe', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s may attending %s's event", $formattedItem['author-name'], $formattedItem['parent-author-name']), @@ -168,7 +168,7 @@ class FormattedNotify extends BaseFactory return new ValueObject\FormattedNotify( 'friend', - $this->baseUrl->get(true) . '/display/' . $formattedItem['parent-guid'], + $this->baseUrl . '/display/' . $formattedItem['parent-guid'], $formattedItem['author-avatar'], $formattedItem['author-link'], $this->l10n->t("%s is now friends with %s", $formattedItem['author-name'], $formattedItem['fname']), @@ -219,7 +219,7 @@ class FormattedNotify extends BaseFactory foreach ($Notifies as $Notify) { $formattedNotifications[] = new ValueObject\FormattedNotify( 'notification', - $this->baseUrl->get(true) . '/notify/' . $Notify->id, + $this->baseUrl . '/notify/' . $Notify->id, Contact::getAvatarUrlForUrl($Notify->url, $Notify->uid, Proxy::SIZE_MICRO), $Notify->url, strip_tags(BBCode::toPlaintext($Notify->msg)), @@ -369,7 +369,7 @@ class FormattedNotify extends BaseFactory } $item['label'] = (($item['gravity'] == Item::GRAVITY_PARENT) ? 'post' : 'comment'); - $item['link'] = $this->baseUrl->get(true) . '/display/' . $item['parent-guid']; + $item['link'] = $this->baseUrl . '/display/' . $item['parent-guid']; $item['image'] = $item['author-avatar']; $item['url'] = $item['author-link']; $item['when'] = DateTimeFormat::local($item['created'], 'r'); diff --git a/src/Navigation/Notifications/Factory/Introduction.php b/src/Navigation/Notifications/Factory/Introduction.php index 1b8dda48d..bc5affd69 100644 --- a/src/Navigation/Notifications/Factory/Introduction.php +++ b/src/Navigation/Notifications/Factory/Introduction.php @@ -125,8 +125,8 @@ class Introduction extends BaseFactory continue; } $return_addr = bin2hex($this->nick . '@' . - $this->baseUrl->getHostname() . - (($this->baseUrl->getUrlPath()) ? '/' . $this->baseUrl->getUrlPath() : '')); + $this->baseUrl->getHost() . + (($this->baseUrl->getPath()) ? '/' . $this->baseUrl->getPath() : '')); $formattedIntroductions[] = new ValueObject\Introduction([ 'label' => 'friend_suggestion', diff --git a/src/Navigation/Notifications/Repository/Notify.php b/src/Navigation/Notifications/Repository/Notify.php index 2d15dd85c..d1256f7d9 100644 --- a/src/Navigation/Notifications/Repository/Notify.php +++ b/src/Navigation/Notifications/Repository/Notify.php @@ -264,7 +264,7 @@ class Notify extends BaseRepository } } - $siteurl = $this->baseUrl->get(true); + $siteurl = $this->baseUrl; $sitename = $this->config->get('config', 'sitename'); // with $params['show_in_notification_page'] == false, the notification isn't inserted into @@ -539,7 +539,7 @@ class Notify extends BaseRepository $nickname = $user['nickname']; - $hostname = $this->baseUrl->getHostname(); + $hostname = $this->baseUrl->getHost(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } @@ -590,7 +590,7 @@ class Notify extends BaseRepository $Notify->updateMsgFromPreamble($epreamble); $Notify = $this->save($Notify); - $itemlink = $this->baseUrl->get() . '/notify/' . $Notify->id; + $itemlink = $this->baseUrl . '/notify/' . $Notify->id; $notify_id = $Notify->id; } @@ -747,7 +747,7 @@ class Notify extends BaseRepository $params['item'] = $item; $params['parent'] = $item['parent']; - $params['link'] = $this->baseUrl->get() . '/display/' . urlencode($item['guid']); + $params['link'] = $this->baseUrl . '/display/' . urlencode($item['guid']); $subjectPrefix = $l10n->t('[Friendica:Notify]'); @@ -807,7 +807,7 @@ class Notify extends BaseRepository $epreamble = $msg['rich']; $sitename = $this->config->get('config', 'sitename'); - $siteurl = $this->baseUrl->get(true); + $siteurl = $this->baseUrl; $sitelink = $l10n->t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf($sitelink, $siteurl); diff --git a/src/Network/HTTPClient/Factory/HttpClient.php b/src/Network/HTTPClient/Factory/HttpClient.php index 5d01d3e12..65f90dab8 100644 --- a/src/Network/HTTPClient/Factory/HttpClient.php +++ b/src/Network/HTTPClient/Factory/HttpClient.php @@ -90,7 +90,7 @@ class HttpClient extends BaseFactory App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION . '; ' . - $this->baseUrl->get(); + $this->baseUrl; $guzzle = new GuzzleHttp\Client([ RequestOptions::ALLOW_REDIRECTS => [ diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 4a1e1ba77..88c256fe0 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -178,7 +178,7 @@ class Probe */ private static function ownHost(string $host): bool { - $own_host = DI::baseUrl()->getHostname(); + $own_host = DI::baseUrl()->getHost(); $parts = parse_url($host); diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index 958e95c17..5a6620977 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -95,7 +95,7 @@ class Account extends BaseDataTransferObject $this->id = (string)$account['pid']; $this->username = $account['nick']; $this->acct = - strpos($account['url'], $baseUrl->get() . '/') === 0 ? + strpos($account['url'], $baseUrl . '/') === 0 ? $account['nick'] : $account['addr']; $this->display_name = $account['name']; diff --git a/src/Object/Api/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php index 007081e91..5459694e6 100644 --- a/src/Object/Api/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -84,14 +84,14 @@ class Instance extends BaseDataTransferObject { $register_policy = intval($config->get('config', 'register_policy')); - $this->uri = $baseUrl->get(); + $this->uri = $baseUrl; $this->title = $config->get('config', 'sitename'); $this->short_description = $this->description = $config->get('config', 'info'); $this->email = implode(',', User::getAdminEmailList()); $this->version = '2.8.0 (compatible; Friendica ' . App::VERSION . ')'; $this->urls = null; // Not supported $this->stats = new Stats($config, $database); - $this->thumbnail = $baseUrl->get() . 'images/friendica-banner.jpg'; + $this->thumbnail = $baseUrl . 'images/friendica-banner.jpg'; $this->languages = [$config->get('system', 'language')]; $this->max_toot_chars = (int)$config->get('config', 'api_import_size', $config->get('config', 'max_import_size')); $this->registrations = ($register_policy != Register::CLOSED); diff --git a/src/Object/Api/Mastodon/Mention.php b/src/Object/Api/Mastodon/Mention.php index 6ff1c987f..dca2c44f9 100644 --- a/src/Object/Api/Mastodon/Mention.php +++ b/src/Object/Api/Mastodon/Mention.php @@ -56,7 +56,7 @@ class Mention extends BaseDataTransferObject if (!empty($contact)) { $this->acct = - strpos($contact['url'], $baseUrl->get() . '/') === 0 ? + strpos($contact['url'], $baseUrl . '/') === 0 ? $contact['nick'] : $contact['addr']; diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index e3f322778..51f0b1c39 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -25,6 +25,7 @@ use Friendica\BaseDataTransferObject; use Friendica\Content\Text\BBCode; use Friendica\Model\Item; use Friendica\Object\Api\Mastodon\Status\Counts; +use Friendica\Object\Api\Mastodon\Status\FriendicaExtension; use Friendica\Object\Api\Mastodon\Status\UserAttributes; use Friendica\Util\DateTimeFormat; @@ -95,6 +96,8 @@ class Status extends BaseDataTransferObject protected $card = null; /** @var Poll|null */ protected $poll = null; + /** @var FriendicaExtension */ + protected $friendica; /** * Creates a status record from an item record. @@ -148,6 +151,7 @@ class Status extends BaseDataTransferObject $this->emojis = []; $this->card = $card->toArray() ?: null; $this->poll = $poll; + $this->friendica = new FriendicaExtension($item['title']); } /** diff --git a/src/Object/Api/Mastodon/Status/FriendicaExtension.php b/src/Object/Api/Mastodon/Status/FriendicaExtension.php new file mode 100644 index 000000000..050c5a026 --- /dev/null +++ b/src/Object/Api/Mastodon/Status/FriendicaExtension.php @@ -0,0 +1,48 @@ +. + * + */ + +namespace Friendica\Object\Api\Mastodon\Status; + +use Friendica\BaseDataTransferObject; + +/** + * Class FriendicaExtension + * + * Additional fields on Mastodon Statuses for storing Friendica specific data + * + * @see https://docs.joinmastodon.org/entities/status + */ +class FriendicaExtension extends BaseDataTransferObject +{ + /** @var string */ + protected $title; + + /** + * Creates a status count object + * + * @param string $title + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public function __construct(string $title) + { + $this->title = $title; + } +} diff --git a/src/Protocol/Activity.php b/src/Protocol/Activity.php index c5fca4a5c..36bc5e99b 100644 --- a/src/Protocol/Activity.php +++ b/src/Protocol/Activity.php @@ -169,7 +169,21 @@ final class Activity * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-read * @var string */ - const READ = ActivityNamespace::ACTIVITY2 . 'read'; + const READ = ActivityNamespace::ACTIVITY2 . 'Read'; + /** + * Indicates that the actor has listened to the object. + * + * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-listen + * @var string + */ + const LISTEN = ActivityNamespace::ACTIVITY2 . 'Listen'; + /** + * Indicates that the actor has viewed the object. + * + * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-view + * @var string + */ + const VIEW = ActivityNamespace::ACTIVITY2 . 'View'; const O_UNFOLLOW = ActivityNamespace::OSTATUS . '/unfollow'; const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite'; @@ -181,13 +195,6 @@ final class Activity */ const EMOJIREACT = ActivityNamespace::LITEPUB . '/emojireact'; - /** - * View notification from Peertube - * - * @var string - */ - const VIEW = ActivityNamespace::PEERTUBE . '/view'; - /** * likes (etc.) can apply to other things besides posts. Check if they are post children, * in which case we handle them specially diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 16257c2f9..4b8f1557b 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -559,7 +559,7 @@ class Receiver return true; } - if ($type == 'as:View') { + if (!DI::config()->get('system', 'process_view') && ($type == 'as:View')) { Logger::info('View activities are ignored.', ['signer' => $signer, 'http_signer' => $http_signer]); return true; } diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 4b63463b4..02dc7ff54 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -330,7 +330,7 @@ class Transmitter return [ 'type' => 'Service', 'name' => App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION, - 'url' => DI::baseUrl()->get() + 'url' => DI::baseUrl() ]; } diff --git a/src/Protocol/Delivery.php b/src/Protocol/Delivery.php index a4fe943da..c8039344e 100644 --- a/src/Protocol/Delivery.php +++ b/src/Protocol/Delivery.php @@ -161,7 +161,7 @@ class Delivery // if $parent['wall'] == 1 we will already have the parent message in our array // and we will relay the whole lot. - $localhost = DI::baseUrl()->getHostname(); + $localhost = DI::baseUrl()->getHost(); if (strpos($localhost, ':')) { $localhost = substr($localhost, 0, strpos($localhost, ':')); } @@ -556,7 +556,7 @@ class Delivery $headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n"; } } else { - $sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHostname()); + $sender = DI::config()->get('config', 'sender_email', 'noreply@' . DI::baseUrl()->getHost()); $headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <' . $sender . '>' . "\n"; } diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index f7bc282c1..7d778ee58 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -629,7 +629,7 @@ class Feed // Distributed items should have a well-formatted URI. // Additionally, we have to avoid conflicts with identical URI between imported feeds and these items. if ($notify) { - $item['guid'] = Item::guidFromUri($orig_plink, DI::baseUrl()->getHostname()); + $item['guid'] = Item::guidFromUri($orig_plink, DI::baseUrl()->getHost()); $item['uri'] = Item::newURI($item['guid']); unset($item['plink']); unset($item['thr-parent']); diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 2a160724b..80644329f 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1395,8 +1395,8 @@ class OStatus } $item['uri'] = $item['parent-uri'] = $item['thr-parent'] - = 'tag:' . DI::baseUrl()->getHostname(). - ','.date('Y-m-d').':'.$action.':'.$owner['uid']. + = 'tag:' . DI::baseUrl()->getHost() . + ','.date('Y-m-d').':'.$action.':'.$owner['uid']. ':person:'.$connect_id.':'.$item['created']; $item['body'] = sprintf($message, $owner['nick'], $contact['nick']); diff --git a/src/Security/Authentication.php b/src/Security/Authentication.php index d21e0bcef..4db5fdfed 100644 --- a/src/Security/Authentication.php +++ b/src/Security/Authentication.php @@ -230,11 +230,11 @@ class Authentication // Otherwise it's probably an openid. try { - $openid = new LightOpenID($this->baseUrl->getHostname()); + $openid = new LightOpenID($this->baseUrl->getHost()); $openid->identity = $openid_url; $this->session->set('openid', $openid_url); $this->session->set('remember', $remember); - $openid->returnUrl = $this->baseUrl->get(true) . '/openid'; + $openid->returnUrl = $this->baseUrl . '/openid'; $openid->optional = ['namePerson/friendly', 'contact/email', 'namePerson', 'namePerson/first', 'media/image/aspect11', 'media/image/default']; System::externalRedirect($openid->authUrl()); } catch (Exception $e) { @@ -329,8 +329,8 @@ class Authentication 'mobile-theme' => $this->pConfig->get($user_record['uid'], 'system', 'mobile_theme'), 'authenticated' => 1, 'page_flags' => $user_record['page-flags'], - 'my_url' => $this->baseUrl->get() . '/profile/' . $user_record['nickname'], - 'my_address' => $user_record['nickname'] . '@' . substr($this->baseUrl->get(), strpos($this->baseUrl->get(), '://') + 3), + 'my_url' => $this->baseUrl . '/profile/' . $user_record['nickname'], + 'my_address' => $user_record['nickname'] . '@' . substr($this->baseUrl, strpos($this->baseUrl, '://') + 3), 'addr' => $this->remoteAddress, 'nickname' => $user_record['nickname'], ]); diff --git a/src/Security/ExAuth.php b/src/Security/ExAuth.php index 602acb0cb..af04e8013 100644 --- a/src/Security/ExAuth.php +++ b/src/Security/ExAuth.php @@ -201,7 +201,7 @@ class ExAuth $sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]); // Does the hostname match? So we try directly - if ($this->baseURL->getHostname() == $aCommand[2]) { + if ($this->baseURL->getHost() == $aCommand[2]) { $this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]); $found = $this->dba->exists('user', ['nickname' => $sUser]); } else { @@ -282,7 +282,7 @@ class ExAuth $Error = false; // Does the hostname match? So we try directly - if ($this->baseURL->getHostname() == $aCommand[2]) { + if ($this->baseURL->getHost() == $aCommand[2]) { try { $this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]); User::getIdFromPasswordAuthentication($sUser, $aCommand[3], true); diff --git a/src/Util/EMailer/MailBuilder.php b/src/Util/EMailer/MailBuilder.php index 1310fee87..96e3a0928 100644 --- a/src/Util/EMailer/MailBuilder.php +++ b/src/Util/EMailer/MailBuilder.php @@ -72,7 +72,7 @@ abstract class MailBuilder $this->config = $config; $this->logger = $logger; - $hostname = $baseUrl->getHostname(); + $hostname = $baseUrl->getHost(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } @@ -83,7 +83,7 @@ abstract class MailBuilder 'X-Friendica-Platform' => [App::PLATFORM], 'X-Friendica-Version' => [App::VERSION], 'List-ID' => [''], - 'List-Archive' => ['<' . $baseUrl->get() . '/notifications/system>'], + 'List-Archive' => ['<' . $baseUrl . '/notifications/system>'], ]; } @@ -262,7 +262,7 @@ abstract class MailBuilder '$htmlversion' => $msgHtml, '$sitename' => $this->config->get('config', 'sitename'), '$banner' => $this->config->get('system', 'email_banner', - $this->baseUrl->get(true) . DIRECTORY_SEPARATOR . self::DEFAULT_EMAIL_BANNER), + $this->baseUrl . DIRECTORY_SEPARATOR . self::DEFAULT_EMAIL_BANNER), ]); } diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index d1973237d..5e4d98d4c 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -65,7 +65,7 @@ class Emailer $this->siteEmailAddress = $this->config->get('config', 'sender_email'); if (empty($this->siteEmailAddress)) { - $hostname = $this->baseUrl->getHostname(); + $hostname = $this->baseUrl->getHost(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } diff --git a/src/Worker/NodeInfo.php b/src/Worker/NodeInfo.php index f42a832b3..81007b237 100644 --- a/src/Worker/NodeInfo.php +++ b/src/Worker/NodeInfo.php @@ -33,7 +33,7 @@ class NodeInfo Logger::info('start'); ModelNodeInfo::update(); // Now trying to register - $url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname(); + $url = 'http://the-federation.info/register/' . DI::baseUrl()->getHost(); Logger::debug('Check registering url', ['url' => $url]); $ret = DI::httpClient()->fetch($url, HttpClientAccept::HTML); Logger::debug('Check registering answer', ['answer' => $ret]); diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index e4189c2c7..93c6c180a 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -212,7 +212,7 @@ class Notifier // if $parent['wall'] == 1 we will already have the parent message in our array // and we will relay the whole lot. - $localhost = str_replace('www.','', DI::baseUrl()->getHostname()); + $localhost = str_replace('www.','', DI::baseUrl()->getHost()); if (strpos($localhost,':')) { $localhost = substr($localhost,0,strpos($localhost,':')); } diff --git a/src/Worker/OptimizeTables.php b/src/Worker/OptimizeTables.php index c1d7b8f6f..bb4cc9e48 100644 --- a/src/Worker/OptimizeTables.php +++ b/src/Worker/OptimizeTables.php @@ -46,6 +46,32 @@ class OptimizeTables DBA::e("OPTIMIZE TABLE `parsed_url`"); DBA::e("OPTIMIZE TABLE `session`"); + if (DI::config()->get('system', 'optimize_all_tables')) { + DBA::e("OPTIMIZE TABLE `apcontact`"); + DBA::e("OPTIMIZE TABLE `contact`"); + DBA::e("OPTIMIZE TABLE `contact-relation`"); + DBA::e("OPTIMIZE TABLE `conversation`"); + DBA::e("OPTIMIZE TABLE `diaspora-contact`"); + DBA::e("OPTIMIZE TABLE `diaspora-interaction`"); + DBA::e("OPTIMIZE TABLE `fcontact`"); + DBA::e("OPTIMIZE TABLE `gserver`"); + DBA::e("OPTIMIZE TABLE `gserver-tag`"); + DBA::e("OPTIMIZE TABLE `inbox-status`"); + DBA::e("OPTIMIZE TABLE `item-uri`"); + DBA::e("OPTIMIZE TABLE `notification`"); + DBA::e("OPTIMIZE TABLE `notify`"); + DBA::e("OPTIMIZE TABLE `photo`"); + DBA::e("OPTIMIZE TABLE `post`"); + DBA::e("OPTIMIZE TABLE `post-content`"); + DBA::e("OPTIMIZE TABLE `post-delivery-data`"); + DBA::e("OPTIMIZE TABLE `post-link`"); + DBA::e("OPTIMIZE TABLE `post-thread`"); + DBA::e("OPTIMIZE TABLE `post-thread-user`"); + DBA::e("OPTIMIZE TABLE `post-user`"); + DBA::e("OPTIMIZE TABLE `storage`"); + DBA::e("OPTIMIZE TABLE `tag`"); + } + Logger::info('Optimize end'); DI::lock()->release('optimize_tables'); diff --git a/src/Worker/PushSubscription.php b/src/Worker/PushSubscription.php index 895a0d0d2..17b47f1cb 100644 --- a/src/Worker/PushSubscription.php +++ b/src/Worker/PushSubscription.php @@ -115,7 +115,7 @@ class PushSubscription $auth = [ 'VAPID' => [ - 'subject' => DI::baseUrl()->getHostname(), + 'subject' => DI::baseUrl()->getHost(), 'publicKey' => ModelSubscription::getPublicVapidKey(), 'privateKey' => ModelSubscription::getPrivateVapidKey(), ], diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index dcab1d0c8..9179921d0 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1514); + define('DB_UPDATE_VERSION', 1516); } return [ diff --git a/static/defaults.config.php b/static/defaults.config.php index bb82473fa..90886347e 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -487,6 +487,10 @@ return [ // Don't show smilies. 'no_smilies' => false, + // optimize_all_tables (Boolean) + // Optimizes all tables instead of only tables like workerqueue or the cache + 'optimize_all_tables' => false, + // paranoia (Boolean) // Log out users if their IP address changed. 'paranoia' => false, @@ -503,6 +507,10 @@ return [ // Sets the ImageMagick compression level for PNG images. Values range from 0 (uncompressed) to 9 (most compressed). 'png_quality' => 8, + // process_view (Boolean) + // Process the "View" activity that is used by Peertube. View activities are displayed, when "emoji_activities" are enabled. + 'process_view' => false, + // profiler (Boolean) // Enable internal timings to help optimize code. Needed for "rendertime" addon. 'profiler' => false, diff --git a/tests/src/App/BaseURLTest.php b/tests/src/App/BaseURLTest.php new file mode 100644 index 000000000..e45b30b20 --- /dev/null +++ b/tests/src/App/BaseURLTest.php @@ -0,0 +1,191 @@ +. + * + */ + +namespace Friendica\Test\src\App; + +use Friendica\App\BaseURL; +use Friendica\Core\Config\Model\ReadOnlyFileConfig; +use Friendica\Core\Config\ValueObject\Cache; +use Friendica\Network\HTTPException\InternalServerErrorException; +use Friendica\Test\MockedTest; +use Psr\Log\NullLogger; + +class BaseURLTest extends MockedTest +{ + public function dataSystemUrl(): array + { + return [ + 'default' => [ + 'input' => ['system' => ['url' => 'https://friendica.local',],], + 'server' => [], + 'assertion' => 'https://friendica.local', + ], + 'subPath' => [ + 'input' => ['system' => ['url' => 'https://friendica.local/subpath',],], + 'server' => [], + 'assertion' => 'https://friendica.local/subpath', + ], + 'empty' => [ + 'input' => [], + 'server' => [], + 'assertion' => 'http://localhost', + ], + 'serverArrayStandard' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/test/it?with=query', + 'QUERY_STRING' => 'pagename=test/it', + ], + 'assertion' => 'https://friendica.server', + ], + 'serverArraySubPath' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/test/it/now?with=query', + 'QUERY_STRING' => 'pagename=it/now', + ], + 'assertion' => 'https://friendica.server/test', + ], + 'serverArraySubPath2' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/test/it/now?with=query', + 'QUERY_STRING' => 'pagename=now', + ], + 'assertion' => 'https://friendica.server/test/it', + ], + 'serverArraySubPath3' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/test/it/now?with=query', + 'QUERY_STRING' => 'pagename=test/it/now', + ], + 'assertion' => 'https://friendica.server', + ], + 'serverArrayWithoutQueryString1' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/test/it/now?with=query', + ], + 'assertion' => 'https://friendica.server/test/it/now', + ], + 'serverArrayWithoutQueryString2' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '', + ], + 'assertion' => 'https://friendica.server', + ], + 'serverArrayWithoutQueryString3' => [ + 'input' => [], + 'server' => [ + 'HTTPS' => 'on', + 'HTTP_HOST' => 'friendica.server', + 'REQUEST_URI' => '/', + ], + 'assertion' => 'https://friendica.server', + ], + ]; + } + + /** + * @dataProvider dataSystemUrl + */ + public function testDetermine(array $input, array $server, string $assertion) + { + $origServerGlobal = $_SERVER; + + $_SERVER = array_merge_recursive($_SERVER, $server); + $config = new ReadOnlyFileConfig(new Cache($input)); + + $baseUrl = new BaseURL($config, new NullLogger(), $server); + + self::assertEquals($assertion, (string)$baseUrl); + + $_SERVER = $origServerGlobal; + } + + public function dataRemove(): array + { + return [ + 'same' => [ + 'base' => ['system' => ['url' => 'https://friendica.local',],], + 'origUrl' => 'https://friendica.local/test/picture.png', + 'assertion' => 'test/picture.png', + ], + 'other' => [ + 'base' => ['system' => ['url' => 'https://friendica.local',],], + 'origUrl' => 'https://friendica.other/test/picture.png', + 'assertion' => 'https://friendica.other/test/picture.png', + ], + 'samSubPath' => [ + 'base' => ['system' => ['url' => 'https://friendica.local/test',],], + 'origUrl' => 'https://friendica.local/test/picture.png', + 'assertion' => 'picture.png', + ], + 'otherSubPath' => [ + 'base' => ['system' => ['url' => 'https://friendica.local/test',],], + 'origUrl' => 'https://friendica.other/test/picture.png', + 'assertion' => 'https://friendica.other/test/picture.png', + ], + ]; + } + + /** + * @dataProvider dataRemove + */ + public function testRemove(array $base, string $origUrl, string $assertion) + { + $config = new ReadOnlyFileConfig(new Cache($base)); + $baseUrl = new BaseURL($config, new NullLogger()); + + self::assertEquals($assertion, $baseUrl->remove($origUrl)); + } + + /** + * Test that redirect to external domains fails + */ + public function testRedirectException() + { + self::expectException(InternalServerErrorException::class); + self::expectErrorMessage('https://friendica.other is not a relative path, please use System::externalRedirect'); + + $config = new ReadOnlyFileConfig(new Cache([ + 'system' => [ + 'url' => 'https://friendica.local', + ] + ])); + $baseUrl = new BaseURL($config, new NullLogger()); + $baseUrl->redirect('https://friendica.other'); + } +} diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php index 2cdbb7239..4c1292344 100644 --- a/tests/src/Content/Text/BBCodeTest.php +++ b/tests/src/Content/Text/BBCodeTest.php @@ -34,13 +34,11 @@ class BBCodeTest extends FixtureTest DI::config()->set('system', 'remove_multiplicated_lines', false); DI::config()->set('system', 'no_oembed', false); DI::config()->set('system', 'allowed_link_protocols', []); - DI::config()->set('system', 'url', 'friendica.local'); + DI::config()->set('system', 'url', 'https://friendica.local'); DI::config()->set('system', 'no_smilies', false); DI::config()->set('system', 'big_emojis', false); DI::config()->set('system', 'allowed_oembed', ''); - DI::baseUrl()->save('friendica.local', DI::baseUrl()::SSL_POLICY_FULL, ''); - $config = \HTMLPurifier_HTML5Config::createDefault(); $config->set('HTML.Doctype', 'HTML5'); $config->set('Attr.AllowedRel', [ diff --git a/tests/src/Core/Config/ConfigTest.php b/tests/src/Core/Config/ConfigTest.php index 643c73754..cf13ea05a 100644 --- a/tests/src/Core/Config/ConfigTest.php +++ b/tests/src/Core/Config/ConfigTest.php @@ -537,4 +537,33 @@ class ConfigTest extends DatabaseTest self::assertEquals($assertion, $config->get($category)); } + + public function dataSerialized(): array + { + return [ + 'default' => [ + 'value' => ['test' => ['array']], + 'assertion' => ['test' => ['array']], + ], + 'issue-12803' => [ + 'value' => 's:48:"s:40:"s:32:"https://punkrock-underground.com";";";', + 'assertion' => 'https://punkrock-underground.com', + ], + 'double-serialized-array' => [ + 'value' => 's:53:"a:1:{s:9:"testArray";a:1:{s:4:"with";s:7:"entries";}}";', + 'assertion' => ['testArray' => ['with' => 'entries']], + ], + ]; + } + + /** + * @dataProvider dataSerialized + */ + public function testSerializedValues($value, $assertion) + { + $config = $this->getInstance(); + + $config->set('test', 'it', $value); + self:self::assertEquals($assertion, $config->get('test', 'it')); + } } diff --git a/tests/src/Core/SystemTest.php b/tests/src/Core/SystemTest.php index 9cfbe052c..c47539c79 100644 --- a/tests/src/Core/SystemTest.php +++ b/tests/src/Core/SystemTest.php @@ -32,7 +32,7 @@ class SystemTest extends TestCase private function useBaseUrl() { $baseUrl = \Mockery::mock(BaseURL::class); - $baseUrl->shouldReceive('getHostname')->andReturn('friendica.local')->once(); + $baseUrl->shouldReceive('getHost')->andReturn('friendica.local')->once(); $dice = \Mockery::mock(Dice::class); $dice->shouldReceive('create')->with(BaseURL::class)->andReturn($baseUrl); diff --git a/tests/src/Model/User/CookieTest.php b/tests/src/Model/User/CookieTest.php index 64d5455ef..372645bf3 100644 --- a/tests/src/Model/User/CookieTest.php +++ b/tests/src/Model/User/CookieTest.php @@ -60,7 +60,7 @@ class CookieTest extends MockedTest */ public function testInstance() { - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn('1235')->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn('7')->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); @@ -127,7 +127,7 @@ class CookieTest extends MockedTest */ public function testGet(array $cookieData, bool $hasValues, $uid, $hash, $ip) { - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn('1235')->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn('7')->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); @@ -188,7 +188,7 @@ class CookieTest extends MockedTest */ public function testCheck(string $serverPrivateKey, string $userPrivateKey, string $password, string $assertHash, bool $assertTrue) { - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn($serverPrivateKey)->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn('7')->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); @@ -248,7 +248,7 @@ class CookieTest extends MockedTest */ public function testSet($serverKey, $uid, $password, $privateKey, $assertHash, $remoteIp, $serverArray) { - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn($serverKey)->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn(Cookie::DEFAULT_EXPIRE)->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); @@ -275,7 +275,7 @@ class CookieTest extends MockedTest */ public function testDoubleSet($serverKey, $uid, $password, $privateKey, $assertHash, $remoteIp, $serverArray) { - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn($serverKey)->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn(Cookie::DEFAULT_EXPIRE)->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); @@ -301,7 +301,7 @@ class CookieTest extends MockedTest Cookie::NAME => 'test' ]; - $this->baseUrl->shouldReceive('getSSLPolicy')->andReturn(true)->once(); + $this->baseUrl->shouldReceive('getScheme')->andReturn('https')->once(); $this->config->shouldReceive('get')->with('system', 'site_prvkey')->andReturn(24)->once(); $this->config->shouldReceive('get')->with('system', 'auth_cookie_lifetime', Cookie::DEFAULT_EXPIRE)->andReturn(Cookie::DEFAULT_EXPIRE)->once(); $this->config->shouldReceive('get')->with('proxy', 'trusted_proxies', '')->andReturn('')->once(); diff --git a/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php index 6311175d3..b6166fc40 100644 --- a/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php +++ b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php @@ -21,12 +21,9 @@ namespace Friendica\Test\src\Module\Api\GnuSocial\GnuSocial; -use Friendica\App\BaseURL; -use Friendica\App\Router; use Friendica\DI; use Friendica\Module\Api\GNUSocial\GNUSocial\Config; use Friendica\Test\src\Module\Api\ApiTest; -use Friendica\Test\Util\VFSTrait; class ConfigTest extends ApiTest { @@ -35,13 +32,11 @@ class ConfigTest extends ApiTest */ public function testApiStatusnetConfig() { - DI::config()->set('system', 'ssl_policy', BaseURL::SSL_POLICY_FULL); - $response = (new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [])) ->run($this->httpExceptionMock); $json = $this->toJson($response); - self::assertEquals(DI::config()->get('config', 'hostname'), $json->site->server); + self::assertEquals(DI::baseUrl()->getHost(), $json->site->server); self::assertEquals(DI::config()->get('system', 'theme'), $json->site->theme); self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $json->site->logo); self::assertTrue($json->site->fancy); diff --git a/tests/src/Util/BaseURLTest.php b/tests/src/Util/BaseURLTest.php deleted file mode 100644 index a72ffc607..000000000 --- a/tests/src/Util/BaseURLTest.php +++ /dev/null @@ -1,473 +0,0 @@ -. - * - */ - -namespace Friendica\Test\src\Util; - -use Friendica\App\BaseURL; -use Friendica\Core\Config\Capability\IManageConfigValues; -use Friendica\Core\Config\Model\DatabaseConfig; -use Friendica\Core\Config\Model\ReadOnlyFileConfig; -use Friendica\Core\Config\Util\ConfigFileManager; -use Friendica\Core\Config\ValueObject\Cache; -use Friendica\Test\DatabaseTest; -use Friendica\Test\Util\CreateDatabaseTrait; -use Friendica\Test\Util\VFSTrait; - -class BaseURLTest extends DatabaseTest -{ - use VFSTrait; - use CreateDatabaseTrait; - - protected function setUp(): void - { - parent::setUp(); - - $this->setUpVfsDir(); - } - - public function dataDefault() - { - return [ - 'null' => [ - 'server' => [], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => '', - 'urlPath' => '', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://', - 'scheme' => 'http', - ], - ], - 'WithSubDirectory' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'REDIRECT_URI' => 'test/module/more', - 'QUERY_STRING' => 'module/more', - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.local/test', - 'scheme' => 'http', - ], - ], - 'input' => [ - 'server' => [], - 'input' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'http://friendica.local/test', - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'http://friendica.local/test', - 'scheme' => 'http', - ], - ], - 'WithHttpsScheme' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'REDIRECT_URI' => 'test/module/more', - 'QUERY_STRING' => 'module/more', - 'HTTPS' => true, - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local/test', - 'scheme' => 'https', - ], - ], - 'WithoutQueryString' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'REDIRECT_URI' => 'test/more', - 'HTTPS' => true, - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test/more', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local/test/more', - 'scheme' => 'https', - ], - ], - 'WithPort' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'SERVER_PORT' => '1234', - 'REDIRECT_URI' => 'test/more', - 'HTTPS' => true, - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local:1234', - 'urlPath' => 'test/more', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local:1234/test/more', - 'scheme' => 'https', - ], - ], - 'With443Port' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'SERVER_PORT' => '443', - 'REDIRECT_URI' => 'test/more', - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test/more', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local/test/more', - 'scheme' => 'https', - ], - ], - 'With80Port' => [ - 'server' => [ - 'SERVER_NAME' => 'friendica.local', - 'SERVER_PORT' => '80', - 'REDIRECT_URI' => 'test/more', - ], - 'input' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - 'url' => null, - ], - 'assert' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'test/more', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.local/test/more', - 'scheme' => 'http', - ], - ], - ]; - } - - public function dataSave() - { - return [ - 'no_change' => [ - 'input' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'path', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'path', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - ], - 'url' => 'https://friendica.local/path', - ], - 'default' => [ - 'input' => [ - 'hostname' => 'friendica.old', - 'urlPath' => 'is/old/path', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.old/is/old/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => 'friendica.local', - 'urlPath' => 'new/path', - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - ], - 'url' => 'https://friendica.local/new/path', - ], - 'null' => [ - 'input' => [ - 'hostname' => 'friendica.old', - 'urlPath' => 'is/old/path', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.old/is/old/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => null, - ], - 'url' => 'http://friendica.old/is/old/path', - ], - 'changeHostname' => [ - 'input' => [ - 'hostname' => 'friendica.old', - 'urlPath' => 'is/old/path', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.old/is/old/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => 'friendica.local', - 'urlPath' => null, - 'sslPolicy' => null, - ], - 'url' => 'http://friendica.local/is/old/path', - ], - 'changeUrlPath' => [ - 'input' => [ - 'hostname' => 'friendica.old', - 'urlPath' => 'is/old/path', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.old/is/old/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => null, - 'urlPath' => 'new/path', - 'sslPolicy' => null, - ], - 'url' => 'http://friendica.old/new/path', - ], - 'changeSSLPolicy' => [ - 'input' => [ - 'hostname' => 'friendica.old', - 'urlPath' => 'is/old/path', - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'http://friendica.old/is/old/path', - 'force_ssl' => true, - ], - 'save' => [ - 'hostname' => null, - 'urlPath' => null, - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - ], - 'url' => 'https://friendica.old/is/old/path', - ], - ]; - } - - /** - * Test the save() method - * @dataProvider dataSave - */ - public function testSave($input, $save, $url) - { - $config = new DatabaseConfig($this->getDbInstance(), new Cache([ - 'config' => [ - 'hostname' => $input['hostname'] ?? null, - ], - 'system' => [ - 'urlpath' => $input['urlPath'] ?? null, - 'ssl_policy' => $input['sslPolicy'] ?? null, - 'url' => $input['url'] ?? null, - 'force_ssl' => $input['force_ssl'] ?? null, - ], - ])); - - $baseUrl = new BaseURL($config, []); - - $baseUrl->save($save['hostname'], $save['sslPolicy'], $save['urlPath']); - - self::assertEquals($url, $baseUrl->get()); - } - - /** - * Test the saveByUrl() method - * @dataProvider dataSave - * - * @param $input - * @param $save - * @param $url - */ - public function testSaveByUrl($input, $save, $url) - { - $config = new DatabaseConfig($this->getDbInstance(), new Cache([ - 'config' => [ - 'hostname' => $input['hostname'] ?? null, - ], - 'system' => [ - 'urlpath' => $input['urlPath'] ?? null, - 'ssl_policy' => $input['sslPolicy'] ?? null, - 'url' => $input['url'] ?? null, - 'force_ssl' => $input['force_ssl'] ?? null, - ], - ])); - - $baseUrl = new BaseURL($config, []); - - $baseUrl->saveByURL($url); - - self::assertEquals($url, $baseUrl->get()); - } - - public function dataGetBaseUrl() - { - return [ - 'default' => [ - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'ssl' => false, - 'url' => 'http://friendica.local/new/test', - 'assert' => 'http://friendica.local/new/test', - ], - 'DefaultWithSSL' => [ - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'ssl' => true, - 'url' => 'http://friendica.local/new/test', - 'assert' => 'https://friendica.local/new/test', - ], - 'SSLFullWithSSL' => [ - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'ssl' => true, - 'url' => 'http://friendica.local/new/test', - 'assert' => 'http://friendica.local/new/test', - ], - 'SSLFullWithoutSSL' => [ - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'ssl' => false, - 'url' => 'https://friendica.local/new/test', - 'assert' => 'https://friendica.local/new/test', - ], - 'NoSSLWithSSL' => [ - 'sslPolicy' => BaseURL::SSL_POLICY_NONE, - 'ssl' => true, - 'url' => 'http://friendica.local/new/test', - 'assert' => 'http://friendica.local/new/test', - ], - 'NoSSLWithoutSSL' => [ - 'sslPolicy' => BaseURL::SSL_POLICY_NONE, - 'ssl' => false, - 'url' => 'http://friendica.local/new/test', - 'assert' => 'http://friendica.local/new/test', - ], - ]; - } - - /** - * Test the get() method - * @dataProvider dataGetBaseUrl - */ - public function testGetURL($sslPolicy, $ssl, $url, $assert) - { - $configMock = \Mockery::mock(IManageConfigValues::class); - $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local'); - $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test'); - $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy); - $configMock->shouldReceive('get')->with('system', 'url')->andReturn($url); - - $baseUrl = new BaseURL($configMock, []); - - self::assertEquals($assert, $baseUrl->get($ssl)); - } - - public function dataCheckRedirectHTTPS() - { - return [ - 'default' => [ - 'server' => [ - 'REQUEST_METHOD' => 'GET', - 'HTTPS' => true, - ], - 'forceSSL' => false, - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'https://friendica.local', - 'redirect' => false, - ], - 'forceSSL' => [ - 'server' => [ - 'REQUEST_METHOD' => 'GET', - ], - 'forceSSL' => true, - 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME, - 'url' => 'https://friendica.local', - 'redirect' => false, - ], - 'forceSSLWithSSLPolicy' => [ - 'server' => [], - 'forceSSL' => true, - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local', - 'redirect' => false, - ], - 'forceSSLWithSSLPolicyAndGet' => [ - 'server' => [ - 'REQUEST_METHOD' => 'GET', - ], - 'forceSSL' => true, - 'sslPolicy' => BaseURL::SSL_POLICY_FULL, - 'url' => 'https://friendica.local', - 'redirect' => true, - ], - ]; - } - - /** - * Test the checkRedirectHTTPS() method - * @dataProvider dataCheckRedirectHTTPS - */ - public function testCheckRedirectHTTPS($server, $forceSSL, $sslPolicy, $url, $redirect) - { - $configMock = \Mockery::mock(IManageConfigValues::class); - $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local'); - $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test'); - $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy); - $configMock->shouldReceive('get')->with('system', 'url')->andReturn($url); - $configMock->shouldReceive('get')->with('system', 'force_ssl')->andReturn($forceSSL); - - $baseUrl = new BaseURL($configMock, $server); - - self::assertEquals($redirect, $baseUrl->checkRedirectHttps()); - } -} diff --git a/tests/src/Util/EMailerTest.php b/tests/src/Util/EMailerTest.php index b43482b30..6432d5800 100644 --- a/tests/src/Util/EMailerTest.php +++ b/tests/src/Util/EMailerTest.php @@ -68,8 +68,8 @@ class EMailerTest extends MockedTest $this->pConfig = \Mockery::mock(IManagePersonalConfigValues::class); $this->l10n = \Mockery::mock(L10n::class); $this->baseUrl = \Mockery::mock(BaseURL::class); - $this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local'); - $this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local'); + $this->baseUrl->shouldReceive('getHost')->andReturn('friendica.local'); + $this->baseUrl->shouldReceive('__toString')->andReturn('http://friendica.local'); } protected function tearDown(): void diff --git a/tests/src/Util/Emailer/MailBuilderTest.php b/tests/src/Util/Emailer/MailBuilderTest.php index 76d2ef191..ecfed9f08 100644 --- a/tests/src/Util/Emailer/MailBuilderTest.php +++ b/tests/src/Util/Emailer/MailBuilderTest.php @@ -60,8 +60,8 @@ class MailBuilderTest extends MockedTest $this->config = \Mockery::mock(IManageConfigValues::class); $this->l10n = \Mockery::mock(L10n::class); $this->baseUrl = \Mockery::mock(BaseURL::class); - $this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local'); - $this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local'); + $this->baseUrl->shouldReceive('getHost')->andReturn('friendica.local'); + $this->baseUrl->shouldReceive('__toString')->andReturn('http://friendica.local'); $this->defaultHeaders = []; } diff --git a/tests/src/Util/Emailer/SystemMailBuilderTest.php b/tests/src/Util/Emailer/SystemMailBuilderTest.php index 13262d207..fe3b57096 100644 --- a/tests/src/Util/Emailer/SystemMailBuilderTest.php +++ b/tests/src/Util/Emailer/SystemMailBuilderTest.php @@ -54,8 +54,8 @@ class SystemMailBuilderTest extends MockedTest return $msg; }); $this->baseUrl = \Mockery::mock(BaseURL::class); - $this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local'); - $this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local'); + $this->baseUrl->shouldReceive('getHost')->andReturn('friendica.local'); + $this->baseUrl->shouldReceive('__toString')->andReturn('http://friendica.local'); } /** diff --git a/update.php b/update.php index 86735f864..672c11a4f 100644 --- a/update.php +++ b/update.php @@ -59,6 +59,7 @@ use Friendica\Model\Photo; use Friendica\Model\Post; use Friendica\Model\Profile; use Friendica\Model\User; +use Friendica\Protocol\Activity; use Friendica\Protocol\Delivery; use Friendica\Security\PermissionSet\Repository\PermissionSet; @@ -1287,3 +1288,30 @@ function update_1514() return Update::SUCCESS; } + +function update_1515() +{ + DBA::update('verb', ['name' => Activity::READ], ['name' => 'https://www.w3.org/ns/activitystreams#read']); + DBA::update('verb', ['name' => Activity::VIEW], ['name' => 'https://joinpeertube.org/view']); + return Update::SUCCESS; +} + +function update_1516() +{ + // Fixes https://github.com/friendica/friendica/issues/12803 + // de-serialize multiple serialized values + $configTrans = DI::config()->beginTransaction(); + $configArray = DI::config()->getCache()->getDataBySource(Cache::SOURCE_DATA); + + foreach ($configArray as $category => $keyValues) { + if (is_array($keyValues)) { + foreach ($keyValues as $key => $value) { + $configTrans->set($category, $key, $value); + } + } + } + + $configTrans->commit(); + + return Update::SUCCESS; +} diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 723cbe87d..1d8a5a33d 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-02-18 06:38+0000\n" +"POT-Creation-Date: 2023-02-18 20:49+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -307,8 +307,8 @@ msgstr "" #: src/Module/Debug/Babel.php:313 src/Module/Debug/Localtime.php:64 #: src/Module/Debug/Probe.php:54 src/Module/Debug/WebFinger.php:51 #: src/Module/Delegation.php:147 src/Module/FriendSuggest.php:145 -#: src/Module/Install.php:252 src/Module/Install.php:294 -#: src/Module/Install.php:331 src/Module/Invite.php:178 +#: src/Module/Install.php:234 src/Module/Install.php:274 +#: src/Module/Install.php:309 src/Module/Invite.php:178 #: src/Module/Item/Compose.php:189 src/Module/Moderation/Item/Source.php:79 #: src/Module/Profile/Profile.php:274 src/Module/Profile/UnkMail.php:156 #: src/Module/Settings/Profile/Index.php:231 src/Object/Post.php:1058 @@ -653,7 +653,7 @@ msgstr "" msgid "No system theme config value set." msgstr "" -#: src/App.php:573 +#: src/App.php:574 msgid "Apologies but the website is unavailable at the moment." msgstr "" @@ -1504,20 +1504,20 @@ msgid "" "Contact birthday events are private to you." msgstr "" -#: src/Content/ForumManager.php:157 src/Content/Nav.php:278 +#: src/Content/ForumManager.php:151 src/Content/Nav.php:278 #: src/Content/Text/HTML.php:905 src/Content/Widget.php:524 msgid "Forums" msgstr "" -#: src/Content/ForumManager.php:159 +#: src/Content/ForumManager.php:153 msgid "External link to forum" msgstr "" -#: src/Content/ForumManager.php:162 src/Content/Widget.php:503 +#: src/Content/ForumManager.php:156 src/Content/Widget.php:503 msgid "show less" msgstr "" -#: src/Content/ForumManager.php:163 src/Content/Widget.php:405 +#: src/Content/ForumManager.php:157 src/Content/Widget.php:405 #: src/Content/Widget.php:504 msgid "show more" msgstr "" @@ -2245,29 +2245,29 @@ msgstr "" msgid "Connectors" msgstr "" -#: src/Core/Installer.php:183 +#: src/Core/Installer.php:180 msgid "" "The database configuration file \"config/local.config.php\" could not be " "written. Please use the enclosed text to create a configuration file in your " "web server root." msgstr "" -#: src/Core/Installer.php:200 +#: src/Core/Installer.php:197 msgid "" "You may need to import the file \"database.sql\" manually using phpmyadmin " "or mysql." msgstr "" -#: src/Core/Installer.php:201 src/Module/Install.php:213 -#: src/Module/Install.php:372 +#: src/Core/Installer.php:198 src/Module/Install.php:207 +#: src/Module/Install.php:350 msgid "Please see the file \"doc/INSTALL.md\"." msgstr "" -#: src/Core/Installer.php:262 +#: src/Core/Installer.php:259 msgid "Could not find a command line version of PHP in the web server PATH." msgstr "" -#: src/Core/Installer.php:263 +#: src/Core/Installer.php:260 msgid "" "If you don't have a command line version of PHP installed on your server, " "you will not be able to run the background processing. See 'Setup the worker'" msgstr "" -#: src/Core/Installer.php:268 +#: src/Core/Installer.php:265 msgid "PHP executable path" msgstr "" -#: src/Core/Installer.php:268 +#: src/Core/Installer.php:265 msgid "" "Enter full path to php executable. You can leave this blank to continue the " "installation." msgstr "" -#: src/Core/Installer.php:273 +#: src/Core/Installer.php:270 msgid "Command line PHP" msgstr "" -#: src/Core/Installer.php:282 +#: src/Core/Installer.php:279 msgid "PHP executable is not the php cli binary (could be cgi-fgci version)" msgstr "" -#: src/Core/Installer.php:283 +#: src/Core/Installer.php:280 msgid "Found PHP version: " msgstr "" -#: src/Core/Installer.php:285 +#: src/Core/Installer.php:282 msgid "PHP cli binary" msgstr "" -#: src/Core/Installer.php:298 +#: src/Core/Installer.php:295 msgid "" "The command line version of PHP on your system does not have " "\"register_argc_argv\" enabled." msgstr "" -#: src/Core/Installer.php:299 +#: src/Core/Installer.php:296 msgid "This is required for message delivery to work." msgstr "" -#: src/Core/Installer.php:304 +#: src/Core/Installer.php:301 msgid "PHP register_argc_argv" msgstr "" -#: src/Core/Installer.php:336 +#: src/Core/Installer.php:333 msgid "" "Error: the \"openssl_pkey_new\" function on this system is not able to " "generate encryption keys" msgstr "" -#: src/Core/Installer.php:337 +#: src/Core/Installer.php:334 msgid "" "If running under Windows, please see \"http://www.php.net/manual/en/openssl." "installation.php\"." msgstr "" -#: src/Core/Installer.php:340 +#: src/Core/Installer.php:337 msgid "Generate encryption keys" msgstr "" -#: src/Core/Installer.php:392 +#: src/Core/Installer.php:389 msgid "" "Error: Apache webserver mod-rewrite module is required but not installed." msgstr "" -#: src/Core/Installer.php:397 +#: src/Core/Installer.php:394 msgid "Apache mod_rewrite module" msgstr "" -#: src/Core/Installer.php:403 +#: src/Core/Installer.php:400 msgid "Error: PDO or MySQLi PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:408 +#: src/Core/Installer.php:405 msgid "Error: The MySQL driver for PDO is not installed." msgstr "" -#: src/Core/Installer.php:412 +#: src/Core/Installer.php:409 msgid "PDO or MySQLi PHP module" msgstr "" -#: src/Core/Installer.php:420 +#: src/Core/Installer.php:417 msgid "Error, XML PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:424 +#: src/Core/Installer.php:421 msgid "XML PHP module" msgstr "" -#: src/Core/Installer.php:427 +#: src/Core/Installer.php:424 msgid "libCurl PHP module" msgstr "" -#: src/Core/Installer.php:428 +#: src/Core/Installer.php:425 msgid "Error: libCURL PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:434 +#: src/Core/Installer.php:431 msgid "GD graphics PHP module" msgstr "" -#: src/Core/Installer.php:435 +#: src/Core/Installer.php:432 msgid "" "Error: GD graphics PHP module with JPEG support required but not installed." msgstr "" -#: src/Core/Installer.php:441 +#: src/Core/Installer.php:438 msgid "OpenSSL PHP module" msgstr "" -#: src/Core/Installer.php:442 +#: src/Core/Installer.php:439 msgid "Error: openssl PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:448 +#: src/Core/Installer.php:445 msgid "mb_string PHP module" msgstr "" -#: src/Core/Installer.php:449 +#: src/Core/Installer.php:446 msgid "Error: mb_string PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:455 +#: src/Core/Installer.php:452 msgid "iconv PHP module" msgstr "" -#: src/Core/Installer.php:456 +#: src/Core/Installer.php:453 msgid "Error: iconv PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:462 +#: src/Core/Installer.php:459 msgid "POSIX PHP module" msgstr "" -#: src/Core/Installer.php:463 +#: src/Core/Installer.php:460 msgid "Error: POSIX PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:469 +#: src/Core/Installer.php:466 msgid "Program execution functions" msgstr "" -#: src/Core/Installer.php:470 +#: src/Core/Installer.php:467 msgid "" "Error: Program execution functions (proc_open) required but not enabled." msgstr "" -#: src/Core/Installer.php:476 +#: src/Core/Installer.php:473 msgid "JSON PHP module" msgstr "" -#: src/Core/Installer.php:477 +#: src/Core/Installer.php:474 msgid "Error: JSON PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:483 +#: src/Core/Installer.php:480 msgid "File Information PHP module" msgstr "" -#: src/Core/Installer.php:484 +#: src/Core/Installer.php:481 msgid "Error: File Information PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:490 +#: src/Core/Installer.php:487 msgid "GNU Multiple Precision PHP module" msgstr "" -#: src/Core/Installer.php:491 +#: src/Core/Installer.php:488 msgid "Error: GNU Multiple Precision PHP module required but not installed." msgstr "" -#: src/Core/Installer.php:514 +#: src/Core/Installer.php:511 msgid "" "The web installer needs to be able to create a file called \"local.config.php" "\" in the \"config\" folder of your web server and it is unable to do so." msgstr "" -#: src/Core/Installer.php:515 +#: src/Core/Installer.php:512 msgid "" "This is most often a permission setting, as the web server may not be able " "to write files in your folder - even if you can." msgstr "" -#: src/Core/Installer.php:516 +#: src/Core/Installer.php:513 msgid "" "At the end of this procedure, we will give you a text to save in a file " "named local.config.php in your Friendica \"config\" folder." msgstr "" -#: src/Core/Installer.php:517 +#: src/Core/Installer.php:514 msgid "" "You can alternatively skip this procedure and perform a manual installation. " "Please see the file \"doc/INSTALL.md\" for instructions." msgstr "" -#: src/Core/Installer.php:520 +#: src/Core/Installer.php:517 msgid "config/local.config.php is writable" msgstr "" -#: src/Core/Installer.php:540 +#: src/Core/Installer.php:537 msgid "" "Friendica uses the Smarty3 template engine to render its web views. Smarty3 " "compiles templates to PHP to speed up rendering." msgstr "" -#: src/Core/Installer.php:541 +#: src/Core/Installer.php:538 msgid "" "In order to store these compiled templates, the web server needs to have " "write access to the directory view/smarty3/ under the Friendica top level " "folder." msgstr "" -#: src/Core/Installer.php:542 +#: src/Core/Installer.php:539 msgid "" "Please ensure that the user that your web server runs as (e.g. www-data) has " "write access to this folder." msgstr "" -#: src/Core/Installer.php:543 +#: src/Core/Installer.php:540 msgid "" "Note: as a security measure, you should give the web server write access to " "view/smarty3/ only--not the template files (.tpl) that it contains." msgstr "" -#: src/Core/Installer.php:546 +#: src/Core/Installer.php:543 msgid "view/smarty3 is writable" msgstr "" -#: src/Core/Installer.php:574 +#: src/Core/Installer.php:571 msgid "" "Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-" "dist to .htaccess." msgstr "" -#: src/Core/Installer.php:575 +#: src/Core/Installer.php:572 msgid "" "In some circumstances (like running inside containers), you can skip this " "error." msgstr "" -#: src/Core/Installer.php:577 +#: src/Core/Installer.php:574 msgid "Error message from Curl when fetching" msgstr "" -#: src/Core/Installer.php:583 +#: src/Core/Installer.php:580 msgid "Url rewrite is working" msgstr "" -#: src/Core/Installer.php:612 +#: src/Core/Installer.php:609 msgid "" "The detection of TLS to secure the communication between the browser and the " "new Friendica server failed." msgstr "" -#: src/Core/Installer.php:613 +#: src/Core/Installer.php:610 msgid "" "It is highly encouraged to use Friendica only over a secure connection as " "sensitive information like passwords will be transmitted." msgstr "" -#: src/Core/Installer.php:614 +#: src/Core/Installer.php:611 msgid "Please ensure that the connection to the server is secure." msgstr "" -#: src/Core/Installer.php:615 +#: src/Core/Installer.php:612 msgid "No TLS detected" msgstr "" -#: src/Core/Installer.php:617 +#: src/Core/Installer.php:614 msgid "TLS detected" msgstr "" -#: src/Core/Installer.php:644 +#: src/Core/Installer.php:641 msgid "ImageMagick PHP extension is not installed" msgstr "" -#: src/Core/Installer.php:646 +#: src/Core/Installer.php:643 msgid "ImageMagick PHP extension is installed" msgstr "" -#: src/Core/Installer.php:648 +#: src/Core/Installer.php:645 msgid "ImageMagick supports GIF" msgstr "" -#: src/Core/Installer.php:670 +#: src/Core/Installer.php:667 msgid "Database already in use." msgstr "" -#: src/Core/Installer.php:675 +#: src/Core/Installer.php:672 msgid "Could not connect to database." msgstr "" @@ -3296,7 +3296,7 @@ msgstr "" msgid "Title/Description:" msgstr "" -#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:217 +#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:221 #: src/Module/Moderation/Summary.php:77 msgid "Summary" msgstr "" @@ -3622,8 +3622,8 @@ msgstr "" #: src/Module/Admin/Addons/Details.php:111 src/Module/Admin/Addons/Index.php:67 #: src/Module/Admin/Federation.php:207 src/Module/Admin/Logs/Settings.php:79 #: src/Module/Admin/Logs/View.php:84 src/Module/Admin/Queue.php:72 -#: src/Module/Admin/Site.php:435 src/Module/Admin/Storage.php:138 -#: src/Module/Admin/Summary.php:216 src/Module/Admin/Themes/Details.php:90 +#: src/Module/Admin/Site.php:389 src/Module/Admin/Storage.php:138 +#: src/Module/Admin/Summary.php:220 src/Module/Admin/Themes/Details.php:90 #: src/Module/Admin/Themes/Index.php:111 src/Module/Admin/Tos.php:77 #: src/Module/Moderation/Users/Create.php:61 #: src/Module/Moderation/Users/Pending.php:96 @@ -3660,7 +3660,7 @@ msgid "Addon %s failed to install." msgstr "" #: src/Module/Admin/Addons/Index.php:69 src/Module/Admin/Features.php:87 -#: src/Module/Admin/Logs/Settings.php:81 src/Module/Admin/Site.php:438 +#: src/Module/Admin/Logs/Settings.php:81 src/Module/Admin/Site.php:392 #: src/Module/Admin/Themes/Index.php:113 src/Module/Admin/Tos.php:86 #: src/Module/Settings/Account.php:560 src/Module/Settings/Addons.php:78 #: src/Module/Settings/Connectors.php:158 @@ -4012,289 +4012,269 @@ msgstr "" msgid "Priority" msgstr "" -#: src/Module/Admin/Site.php:247 +#: src/Module/Admin/Site.php:207 #, php-format msgid "%s is no valid input for maximum image size" msgstr "" -#: src/Module/Admin/Site.php:344 src/Module/Settings/Display.php:169 +#: src/Module/Admin/Site.php:304 src/Module/Settings/Display.php:169 msgid "No special theme for mobile devices" msgstr "" -#: src/Module/Admin/Site.php:361 src/Module/Settings/Display.php:179 +#: src/Module/Admin/Site.php:321 src/Module/Settings/Display.php:179 #, php-format msgid "%s - (Experimental)" msgstr "" -#: src/Module/Admin/Site.php:373 +#: src/Module/Admin/Site.php:333 msgid "No community page" msgstr "" -#: src/Module/Admin/Site.php:374 +#: src/Module/Admin/Site.php:334 msgid "No community page for visitors" msgstr "" -#: src/Module/Admin/Site.php:375 +#: src/Module/Admin/Site.php:335 msgid "Public postings from users of this site" msgstr "" -#: src/Module/Admin/Site.php:376 +#: src/Module/Admin/Site.php:336 msgid "Public postings from the federated network" msgstr "" -#: src/Module/Admin/Site.php:377 +#: src/Module/Admin/Site.php:337 msgid "Public postings from local users and the federated network" msgstr "" -#: src/Module/Admin/Site.php:383 +#: src/Module/Admin/Site.php:343 msgid "Multi user instance" msgstr "" -#: src/Module/Admin/Site.php:406 +#: src/Module/Admin/Site.php:366 msgid "Closed" msgstr "" -#: src/Module/Admin/Site.php:407 +#: src/Module/Admin/Site.php:367 msgid "Requires approval" msgstr "" -#: src/Module/Admin/Site.php:408 +#: src/Module/Admin/Site.php:368 msgid "Open" msgstr "" -#: src/Module/Admin/Site.php:412 src/Module/Install.php:222 -msgid "No SSL policy, links will track page SSL state" -msgstr "" - -#: src/Module/Admin/Site.php:413 src/Module/Install.php:223 -msgid "Force all links to use SSL" -msgstr "" - -#: src/Module/Admin/Site.php:414 src/Module/Install.php:224 -msgid "Self-signed certificate, use SSL for local links only (discouraged)" -msgstr "" - -#: src/Module/Admin/Site.php:418 +#: src/Module/Admin/Site.php:372 msgid "Don't check" msgstr "" -#: src/Module/Admin/Site.php:419 +#: src/Module/Admin/Site.php:373 msgid "check the stable version" msgstr "" -#: src/Module/Admin/Site.php:420 +#: src/Module/Admin/Site.php:374 msgid "check the development version" msgstr "" -#: src/Module/Admin/Site.php:424 +#: src/Module/Admin/Site.php:378 msgid "none" msgstr "" -#: src/Module/Admin/Site.php:425 +#: src/Module/Admin/Site.php:379 msgid "Local contacts" msgstr "" -#: src/Module/Admin/Site.php:426 +#: src/Module/Admin/Site.php:380 msgid "Interactors" msgstr "" -#: src/Module/Admin/Site.php:436 src/Module/BaseAdmin.php:90 +#: src/Module/Admin/Site.php:390 src/Module/BaseAdmin.php:90 msgid "Site" msgstr "" -#: src/Module/Admin/Site.php:437 +#: src/Module/Admin/Site.php:391 msgid "General Information" msgstr "" -#: src/Module/Admin/Site.php:439 +#: src/Module/Admin/Site.php:393 msgid "Republish users to directory" msgstr "" -#: src/Module/Admin/Site.php:440 src/Module/Register.php:152 +#: src/Module/Admin/Site.php:394 src/Module/Register.php:152 msgid "Registration" msgstr "" -#: src/Module/Admin/Site.php:441 +#: src/Module/Admin/Site.php:395 msgid "File upload" msgstr "" -#: src/Module/Admin/Site.php:442 +#: src/Module/Admin/Site.php:396 msgid "Policies" msgstr "" -#: src/Module/Admin/Site.php:443 src/Module/Calendar/Event/Form.php:252 +#: src/Module/Admin/Site.php:397 src/Module/Calendar/Event/Form.php:252 #: src/Module/Contact.php:517 src/Module/Profile/Profile.php:276 msgid "Advanced" msgstr "" -#: src/Module/Admin/Site.php:444 +#: src/Module/Admin/Site.php:398 msgid "Auto Discovered Contact Directory" msgstr "" -#: src/Module/Admin/Site.php:445 +#: src/Module/Admin/Site.php:399 msgid "Performance" msgstr "" -#: src/Module/Admin/Site.php:446 +#: src/Module/Admin/Site.php:400 msgid "Worker" msgstr "" -#: src/Module/Admin/Site.php:447 +#: src/Module/Admin/Site.php:401 msgid "Message Relay" msgstr "" -#: src/Module/Admin/Site.php:448 +#: src/Module/Admin/Site.php:402 msgid "" "Use the command \"console relay\" in the command line to add or remove " "relays." msgstr "" -#: src/Module/Admin/Site.php:449 +#: src/Module/Admin/Site.php:403 msgid "The system is not subscribed to any relays at the moment." msgstr "" -#: src/Module/Admin/Site.php:450 +#: src/Module/Admin/Site.php:404 msgid "The system is currently subscribed to the following relays:" msgstr "" -#: src/Module/Admin/Site.php:452 +#: src/Module/Admin/Site.php:406 msgid "Relocate Node" msgstr "" -#: src/Module/Admin/Site.php:453 +#: src/Module/Admin/Site.php:407 msgid "" "Relocating your node enables you to change the DNS domain of this node and " "keep all the existing users and posts. This process takes a while and can " "only be started from the relocate console command like this:" msgstr "" -#: src/Module/Admin/Site.php:454 +#: src/Module/Admin/Site.php:408 msgid "(Friendica directory)# bin/console relocate https://newdomain.com" msgstr "" -#: src/Module/Admin/Site.php:458 +#: src/Module/Admin/Site.php:412 msgid "Site name" msgstr "" -#: src/Module/Admin/Site.php:459 +#: src/Module/Admin/Site.php:413 msgid "Sender Email" msgstr "" -#: src/Module/Admin/Site.php:459 +#: src/Module/Admin/Site.php:413 msgid "" "The email address your server shall use to send notification emails from." msgstr "" -#: src/Module/Admin/Site.php:460 +#: src/Module/Admin/Site.php:414 msgid "Name of the system actor" msgstr "" -#: src/Module/Admin/Site.php:460 +#: src/Module/Admin/Site.php:414 msgid "" "Name of the internal system account that is used to perform ActivityPub " "requests. This must be an unused username. If set, this can't be changed " "again." msgstr "" -#: src/Module/Admin/Site.php:461 +#: src/Module/Admin/Site.php:415 msgid "Banner/Logo" msgstr "" -#: src/Module/Admin/Site.php:462 +#: src/Module/Admin/Site.php:416 msgid "Email Banner/Logo" msgstr "" -#: src/Module/Admin/Site.php:463 +#: src/Module/Admin/Site.php:417 msgid "Shortcut icon" msgstr "" -#: src/Module/Admin/Site.php:463 +#: src/Module/Admin/Site.php:417 msgid "Link to an icon that will be used for browsers." msgstr "" -#: src/Module/Admin/Site.php:464 +#: src/Module/Admin/Site.php:418 msgid "Touch icon" msgstr "" -#: src/Module/Admin/Site.php:464 +#: src/Module/Admin/Site.php:418 msgid "Link to an icon that will be used for tablets and mobiles." msgstr "" -#: src/Module/Admin/Site.php:465 +#: src/Module/Admin/Site.php:419 msgid "Additional Info" msgstr "" -#: src/Module/Admin/Site.php:465 +#: src/Module/Admin/Site.php:419 #, php-format msgid "" "For public servers: you can add additional information here that will be " "listed at %s/servers." msgstr "" -#: src/Module/Admin/Site.php:466 +#: src/Module/Admin/Site.php:420 msgid "System language" msgstr "" -#: src/Module/Admin/Site.php:467 +#: src/Module/Admin/Site.php:421 msgid "System theme" msgstr "" -#: src/Module/Admin/Site.php:467 +#: src/Module/Admin/Site.php:421 #, php-format msgid "" "Default system theme - may be over-ridden by user profiles - Change default theme settings" msgstr "" -#: src/Module/Admin/Site.php:468 +#: src/Module/Admin/Site.php:422 msgid "Mobile system theme" msgstr "" -#: src/Module/Admin/Site.php:468 +#: src/Module/Admin/Site.php:422 msgid "Theme for mobile devices" msgstr "" -#: src/Module/Admin/Site.php:469 src/Module/Install.php:232 -msgid "SSL link policy" -msgstr "" - -#: src/Module/Admin/Site.php:469 src/Module/Install.php:234 -msgid "Determines whether generated links should be forced to use SSL" -msgstr "" - -#: src/Module/Admin/Site.php:470 +#: src/Module/Admin/Site.php:423 msgid "Force SSL" msgstr "" -#: src/Module/Admin/Site.php:470 +#: src/Module/Admin/Site.php:423 msgid "" "Force all Non-SSL requests to SSL - Attention: on some systems it could lead " "to endless loops." msgstr "" -#: src/Module/Admin/Site.php:471 +#: src/Module/Admin/Site.php:424 msgid "Show help entry from navigation menu" msgstr "" -#: src/Module/Admin/Site.php:471 +#: src/Module/Admin/Site.php:424 msgid "" "Displays the menu entry for the Help pages from the navigation menu. It is " "always accessible by calling /help directly." msgstr "" -#: src/Module/Admin/Site.php:472 +#: src/Module/Admin/Site.php:425 msgid "Single user instance" msgstr "" -#: src/Module/Admin/Site.php:472 +#: src/Module/Admin/Site.php:425 msgid "Make this instance multi-user or single-user for the named user" msgstr "" -#: src/Module/Admin/Site.php:474 +#: src/Module/Admin/Site.php:427 msgid "Maximum image size" msgstr "" -#: src/Module/Admin/Site.php:474 +#: src/Module/Admin/Site.php:427 #, php-format msgid "" "Maximum size in bytes of uploaded images. Default is 0, which means no " @@ -4306,192 +4286,192 @@ msgid "" "to %s (%s byte)" msgstr "" -#: src/Module/Admin/Site.php:478 +#: src/Module/Admin/Site.php:431 msgid "Maximum image length" msgstr "" -#: src/Module/Admin/Site.php:478 +#: src/Module/Admin/Site.php:431 msgid "" "Maximum length in pixels of the longest side of uploaded images. Default is " "-1, which means no limits." msgstr "" -#: src/Module/Admin/Site.php:479 +#: src/Module/Admin/Site.php:432 msgid "JPEG image quality" msgstr "" -#: src/Module/Admin/Site.php:479 +#: src/Module/Admin/Site.php:432 msgid "" "Uploaded JPEGS will be saved at this quality setting [0-100]. Default is " "100, which is full quality." msgstr "" -#: src/Module/Admin/Site.php:481 +#: src/Module/Admin/Site.php:434 msgid "Register policy" msgstr "" -#: src/Module/Admin/Site.php:482 +#: src/Module/Admin/Site.php:435 msgid "Maximum Daily Registrations" msgstr "" -#: src/Module/Admin/Site.php:482 +#: src/Module/Admin/Site.php:435 msgid "" "If registration is permitted above, this sets the maximum number of new user " "registrations to accept per day. If register is set to closed, this setting " "has no effect." msgstr "" -#: src/Module/Admin/Site.php:483 +#: src/Module/Admin/Site.php:436 msgid "Register text" msgstr "" -#: src/Module/Admin/Site.php:483 +#: src/Module/Admin/Site.php:436 msgid "" "Will be displayed prominently on the registration page. You can use BBCode " "here." msgstr "" -#: src/Module/Admin/Site.php:484 +#: src/Module/Admin/Site.php:437 msgid "Forbidden Nicknames" msgstr "" -#: src/Module/Admin/Site.php:484 +#: src/Module/Admin/Site.php:437 msgid "" "Comma separated list of nicknames that are forbidden from registration. " "Preset is a list of role names according RFC 2142." msgstr "" -#: src/Module/Admin/Site.php:485 +#: src/Module/Admin/Site.php:438 msgid "Accounts abandoned after x days" msgstr "" -#: src/Module/Admin/Site.php:485 +#: src/Module/Admin/Site.php:438 msgid "" "Will not waste system resources polling external sites for abandonded " "accounts. Enter 0 for no time limit." msgstr "" -#: src/Module/Admin/Site.php:486 +#: src/Module/Admin/Site.php:439 msgid "Allowed friend domains" msgstr "" -#: src/Module/Admin/Site.php:486 +#: src/Module/Admin/Site.php:439 msgid "" "Comma separated list of domains which are allowed to establish friendships " "with this site. Wildcards are accepted. Empty to allow any domains" msgstr "" -#: src/Module/Admin/Site.php:487 +#: src/Module/Admin/Site.php:440 msgid "Allowed email domains" msgstr "" -#: src/Module/Admin/Site.php:487 +#: src/Module/Admin/Site.php:440 msgid "" "Comma separated list of domains which are allowed in email addresses for " "registrations to this site. Wildcards are accepted. Empty to allow any " "domains" msgstr "" -#: src/Module/Admin/Site.php:488 +#: src/Module/Admin/Site.php:441 msgid "No OEmbed rich content" msgstr "" -#: src/Module/Admin/Site.php:488 +#: src/Module/Admin/Site.php:441 msgid "" "Don't show the rich content (e.g. embedded PDF), except from the domains " "listed below." msgstr "" -#: src/Module/Admin/Site.php:489 +#: src/Module/Admin/Site.php:442 msgid "Trusted third-party domains" msgstr "" -#: src/Module/Admin/Site.php:489 +#: src/Module/Admin/Site.php:442 msgid "" "Comma separated list of domains from which content is allowed to be embedded " "in posts like with OEmbed. All sub-domains of the listed domains are allowed " "as well." msgstr "" -#: src/Module/Admin/Site.php:490 +#: src/Module/Admin/Site.php:443 msgid "Block public" msgstr "" -#: src/Module/Admin/Site.php:490 +#: src/Module/Admin/Site.php:443 msgid "" "Check to block public access to all otherwise public personal pages on this " "site unless you are currently logged in." msgstr "" -#: src/Module/Admin/Site.php:491 +#: src/Module/Admin/Site.php:444 msgid "Force publish" msgstr "" -#: src/Module/Admin/Site.php:491 +#: src/Module/Admin/Site.php:444 msgid "" "Check to force all profiles on this site to be listed in the site directory." msgstr "" -#: src/Module/Admin/Site.php:491 +#: src/Module/Admin/Site.php:444 msgid "Enabling this may violate privacy laws like the GDPR" msgstr "" -#: src/Module/Admin/Site.php:492 +#: src/Module/Admin/Site.php:445 msgid "Global directory URL" msgstr "" -#: src/Module/Admin/Site.php:492 +#: src/Module/Admin/Site.php:445 msgid "" "URL to the global directory. If this is not set, the global directory is " "completely unavailable to the application." msgstr "" -#: src/Module/Admin/Site.php:493 +#: src/Module/Admin/Site.php:446 msgid "Private posts by default for new users" msgstr "" -#: src/Module/Admin/Site.php:493 +#: src/Module/Admin/Site.php:446 msgid "" "Set default post permissions for all new members to the default privacy " "group rather than public." msgstr "" -#: src/Module/Admin/Site.php:494 +#: src/Module/Admin/Site.php:447 msgid "Don't include post content in email notifications" msgstr "" -#: src/Module/Admin/Site.php:494 +#: src/Module/Admin/Site.php:447 msgid "" "Don't include the content of a post/comment/private message/etc. in the " "email notifications that are sent out from this site, as a privacy measure." msgstr "" -#: src/Module/Admin/Site.php:495 +#: src/Module/Admin/Site.php:448 msgid "Disallow public access to addons listed in the apps menu." msgstr "" -#: src/Module/Admin/Site.php:495 +#: src/Module/Admin/Site.php:448 msgid "" "Checking this box will restrict addons listed in the apps menu to members " "only." msgstr "" -#: src/Module/Admin/Site.php:496 +#: src/Module/Admin/Site.php:449 msgid "Don't embed private images in posts" msgstr "" -#: src/Module/Admin/Site.php:496 +#: src/Module/Admin/Site.php:449 msgid "" "Don't replace locally-hosted private photos in posts with an embedded copy " "of the image. This means that contacts who receive posts containing private " "photos will have to authenticate and load each image, which may take a while." msgstr "" -#: src/Module/Admin/Site.php:497 +#: src/Module/Admin/Site.php:450 msgid "Explicit Content" msgstr "" -#: src/Module/Admin/Site.php:497 +#: src/Module/Admin/Site.php:450 msgid "" "Set this to announce that your node is used mostly for explicit content that " "might not be suited for minors. This information will be published in the " @@ -4500,267 +4480,267 @@ msgid "" "will be shown at the user registration page." msgstr "" -#: src/Module/Admin/Site.php:498 +#: src/Module/Admin/Site.php:451 msgid "Proxify external content" msgstr "" -#: src/Module/Admin/Site.php:498 +#: src/Module/Admin/Site.php:451 msgid "" "Route external content via the proxy functionality. This is used for example " "for some OEmbed accesses and in some other rare cases." msgstr "" -#: src/Module/Admin/Site.php:499 +#: src/Module/Admin/Site.php:452 msgid "Cache contact avatars" msgstr "" -#: src/Module/Admin/Site.php:499 +#: src/Module/Admin/Site.php:452 msgid "" "Locally store the avatar pictures of the contacts. This uses a lot of " "storage space but it increases the performance." msgstr "" -#: src/Module/Admin/Site.php:500 +#: src/Module/Admin/Site.php:453 msgid "Allow Users to set remote_self" msgstr "" -#: src/Module/Admin/Site.php:500 +#: src/Module/Admin/Site.php:453 msgid "" "With checking this, every user is allowed to mark every contact as a " "remote_self in the repair contact dialog. Setting this flag on a contact " "causes mirroring every posting of that contact in the users stream." msgstr "" -#: src/Module/Admin/Site.php:501 +#: src/Module/Admin/Site.php:454 msgid "Enable multiple registrations" msgstr "" -#: src/Module/Admin/Site.php:501 +#: src/Module/Admin/Site.php:454 msgid "Enable users to register additional accounts for use as pages." msgstr "" -#: src/Module/Admin/Site.php:502 +#: src/Module/Admin/Site.php:455 msgid "Enable OpenID" msgstr "" -#: src/Module/Admin/Site.php:502 +#: src/Module/Admin/Site.php:455 msgid "Enable OpenID support for registration and logins." msgstr "" -#: src/Module/Admin/Site.php:503 +#: src/Module/Admin/Site.php:456 msgid "Enable Fullname check" msgstr "" -#: src/Module/Admin/Site.php:503 +#: src/Module/Admin/Site.php:456 msgid "" "Enable check to only allow users to register with a space between the first " "name and the last name in their full name." msgstr "" -#: src/Module/Admin/Site.php:504 +#: src/Module/Admin/Site.php:457 msgid "Email administrators on new registration" msgstr "" -#: src/Module/Admin/Site.php:504 +#: src/Module/Admin/Site.php:457 msgid "" "If enabled and the system is set to an open registration, an email for each " "new registration is sent to the administrators." msgstr "" -#: src/Module/Admin/Site.php:505 +#: src/Module/Admin/Site.php:458 msgid "Community pages for visitors" msgstr "" -#: src/Module/Admin/Site.php:505 +#: src/Module/Admin/Site.php:458 msgid "" "Which community pages should be available for visitors. Local users always " "see both pages." msgstr "" -#: src/Module/Admin/Site.php:506 +#: src/Module/Admin/Site.php:459 msgid "Posts per user on community page" msgstr "" -#: src/Module/Admin/Site.php:506 +#: src/Module/Admin/Site.php:459 msgid "" "The maximum number of posts per user on the community page. (Not valid for " "\"Global Community\")" msgstr "" -#: src/Module/Admin/Site.php:508 +#: src/Module/Admin/Site.php:461 msgid "Enable Mail support" msgstr "" -#: src/Module/Admin/Site.php:508 +#: src/Module/Admin/Site.php:461 msgid "" "Enable built-in mail support to poll IMAP folders and to reply via mail." msgstr "" -#: src/Module/Admin/Site.php:509 +#: src/Module/Admin/Site.php:462 msgid "" "Mail support can't be enabled because the PHP IMAP module is not installed." msgstr "" -#: src/Module/Admin/Site.php:510 +#: src/Module/Admin/Site.php:463 msgid "Enable OStatus support" msgstr "" -#: src/Module/Admin/Site.php:510 +#: src/Module/Admin/Site.php:463 msgid "" "Enable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All " "communications in OStatus are public." msgstr "" -#: src/Module/Admin/Site.php:512 +#: src/Module/Admin/Site.php:465 msgid "" "Diaspora support can't be enabled because Friendica was installed into a sub " "directory." msgstr "" -#: src/Module/Admin/Site.php:513 +#: src/Module/Admin/Site.php:466 msgid "Enable Diaspora support" msgstr "" -#: src/Module/Admin/Site.php:513 +#: src/Module/Admin/Site.php:466 msgid "" "Enable built-in Diaspora network compatibility for communicating with " "diaspora servers." msgstr "" -#: src/Module/Admin/Site.php:514 +#: src/Module/Admin/Site.php:467 msgid "Verify SSL" msgstr "" -#: src/Module/Admin/Site.php:514 +#: src/Module/Admin/Site.php:467 msgid "" "If you wish, you can turn on strict certificate checking. This will mean you " "cannot connect (at all) to self-signed SSL sites." msgstr "" -#: src/Module/Admin/Site.php:515 +#: src/Module/Admin/Site.php:468 msgid "Proxy user" msgstr "" -#: src/Module/Admin/Site.php:515 +#: src/Module/Admin/Site.php:468 msgid "User name for the proxy server." msgstr "" -#: src/Module/Admin/Site.php:516 +#: src/Module/Admin/Site.php:469 msgid "Proxy URL" msgstr "" -#: src/Module/Admin/Site.php:516 +#: src/Module/Admin/Site.php:469 msgid "" "If you want to use a proxy server that Friendica should use to connect to " "the network, put the URL of the proxy here." msgstr "" -#: src/Module/Admin/Site.php:517 +#: src/Module/Admin/Site.php:470 msgid "Network timeout" msgstr "" -#: src/Module/Admin/Site.php:517 +#: src/Module/Admin/Site.php:470 msgid "Value is in seconds. Set to 0 for unlimited (not recommended)." msgstr "" -#: src/Module/Admin/Site.php:518 +#: src/Module/Admin/Site.php:471 msgid "Maximum Load Average" msgstr "" -#: src/Module/Admin/Site.php:518 +#: src/Module/Admin/Site.php:471 #, php-format msgid "" "Maximum system load before delivery and poll processes are deferred - " "default %d." msgstr "" -#: src/Module/Admin/Site.php:519 +#: src/Module/Admin/Site.php:472 msgid "Minimal Memory" msgstr "" -#: src/Module/Admin/Site.php:519 +#: src/Module/Admin/Site.php:472 msgid "" "Minimal free memory in MB for the worker. Needs access to /proc/meminfo - " "default 0 (deactivated)." msgstr "" -#: src/Module/Admin/Site.php:520 +#: src/Module/Admin/Site.php:473 msgid "Periodically optimize tables" msgstr "" -#: src/Module/Admin/Site.php:520 +#: src/Module/Admin/Site.php:473 msgid "Periodically optimize tables like the cache and the workerqueue" msgstr "" -#: src/Module/Admin/Site.php:522 +#: src/Module/Admin/Site.php:475 msgid "Discover followers/followings from contacts" msgstr "" -#: src/Module/Admin/Site.php:522 +#: src/Module/Admin/Site.php:475 msgid "" "If enabled, contacts are checked for their followers and following contacts." msgstr "" -#: src/Module/Admin/Site.php:523 +#: src/Module/Admin/Site.php:476 msgid "None - deactivated" msgstr "" -#: src/Module/Admin/Site.php:524 +#: src/Module/Admin/Site.php:477 msgid "" "Local contacts - contacts of our local contacts are discovered for their " "followers/followings." msgstr "" -#: src/Module/Admin/Site.php:525 +#: src/Module/Admin/Site.php:478 msgid "" "Interactors - contacts of our local contacts and contacts who interacted on " "locally visible postings are discovered for their followers/followings." msgstr "" -#: src/Module/Admin/Site.php:527 +#: src/Module/Admin/Site.php:480 msgid "Synchronize the contacts with the directory server" msgstr "" -#: src/Module/Admin/Site.php:527 +#: src/Module/Admin/Site.php:480 msgid "" "if enabled, the system will check periodically for new contacts on the " "defined directory server." msgstr "" -#: src/Module/Admin/Site.php:529 +#: src/Module/Admin/Site.php:482 msgid "Days between requery" msgstr "" -#: src/Module/Admin/Site.php:529 +#: src/Module/Admin/Site.php:482 msgid "Number of days after which a server is requeried for his contacts." msgstr "" -#: src/Module/Admin/Site.php:530 +#: src/Module/Admin/Site.php:483 msgid "Discover contacts from other servers" msgstr "" -#: src/Module/Admin/Site.php:530 +#: src/Module/Admin/Site.php:483 msgid "" "Periodically query other servers for contacts. The system queries Friendica, " "Mastodon and Hubzilla servers." msgstr "" -#: src/Module/Admin/Site.php:531 +#: src/Module/Admin/Site.php:484 msgid "Search the local directory" msgstr "" -#: src/Module/Admin/Site.php:531 +#: src/Module/Admin/Site.php:484 msgid "" "Search the local directory instead of the global directory. When searching " "locally, every search will be executed on the global directory in the " "background. This improves the search results when the search is repeated." msgstr "" -#: src/Module/Admin/Site.php:533 +#: src/Module/Admin/Site.php:486 msgid "Publish server information" msgstr "" -#: src/Module/Admin/Site.php:533 +#: src/Module/Admin/Site.php:486 msgid "" "If enabled, general server and usage data will be published. The data " "contains the name and version of the server, number of users with public " @@ -4768,50 +4748,50 @@ msgid "" "href=\"http://the-federation.info/\">the-federation.info for details." msgstr "" -#: src/Module/Admin/Site.php:535 +#: src/Module/Admin/Site.php:488 msgid "Check upstream version" msgstr "" -#: src/Module/Admin/Site.php:535 +#: src/Module/Admin/Site.php:488 msgid "" "Enables checking for new Friendica versions at github. If there is a new " "version, you will be informed in the admin panel overview." msgstr "" -#: src/Module/Admin/Site.php:536 +#: src/Module/Admin/Site.php:489 msgid "Suppress Tags" msgstr "" -#: src/Module/Admin/Site.php:536 +#: src/Module/Admin/Site.php:489 msgid "Suppress showing a list of hashtags at the end of the posting." msgstr "" -#: src/Module/Admin/Site.php:537 +#: src/Module/Admin/Site.php:490 msgid "Clean database" msgstr "" -#: src/Module/Admin/Site.php:537 +#: src/Module/Admin/Site.php:490 msgid "" "Remove old remote items, orphaned database records and old content from some " "other helper tables." msgstr "" -#: src/Module/Admin/Site.php:538 +#: src/Module/Admin/Site.php:491 msgid "Lifespan of remote items" msgstr "" -#: src/Module/Admin/Site.php:538 +#: src/Module/Admin/Site.php:491 msgid "" "When the database cleanup is enabled, this defines the days after which " "remote items will be deleted. Own items, and marked or filed items are " "always kept. 0 disables this behaviour." msgstr "" -#: src/Module/Admin/Site.php:539 +#: src/Module/Admin/Site.php:492 msgid "Lifespan of unclaimed items" msgstr "" -#: src/Module/Admin/Site.php:539 +#: src/Module/Admin/Site.php:492 msgid "" "When the database cleanup is enabled, this defines the days after which " "unclaimed remote items (mostly content from the relay) will be deleted. " @@ -4819,144 +4799,144 @@ msgid "" "items if set to 0." msgstr "" -#: src/Module/Admin/Site.php:540 +#: src/Module/Admin/Site.php:493 msgid "Lifespan of raw conversation data" msgstr "" -#: src/Module/Admin/Site.php:540 +#: src/Module/Admin/Site.php:493 msgid "" "The conversation data is used for ActivityPub and OStatus, as well as for " "debug purposes. It should be safe to remove it after 14 days, default is 90 " "days." msgstr "" -#: src/Module/Admin/Site.php:541 +#: src/Module/Admin/Site.php:494 msgid "Maximum numbers of comments per post" msgstr "" -#: src/Module/Admin/Site.php:541 +#: src/Module/Admin/Site.php:494 msgid "How much comments should be shown for each post? Default value is 100." msgstr "" -#: src/Module/Admin/Site.php:542 +#: src/Module/Admin/Site.php:495 msgid "Maximum numbers of comments per post on the display page" msgstr "" -#: src/Module/Admin/Site.php:542 +#: src/Module/Admin/Site.php:495 msgid "" "How many comments should be shown on the single view for each post? Default " "value is 1000." msgstr "" -#: src/Module/Admin/Site.php:543 +#: src/Module/Admin/Site.php:496 msgid "Temp path" msgstr "" -#: src/Module/Admin/Site.php:543 +#: src/Module/Admin/Site.php:496 msgid "" "If you have a restricted system where the webserver can't access the system " "temp path, enter another path here." msgstr "" -#: src/Module/Admin/Site.php:544 +#: src/Module/Admin/Site.php:497 msgid "Only search in tags" msgstr "" -#: src/Module/Admin/Site.php:544 +#: src/Module/Admin/Site.php:497 msgid "On large systems the text search can slow down the system extremely." msgstr "" -#: src/Module/Admin/Site.php:545 +#: src/Module/Admin/Site.php:498 msgid "Generate counts per contact group when calculating network count" msgstr "" -#: src/Module/Admin/Site.php:545 +#: src/Module/Admin/Site.php:498 msgid "" "On systems with users that heavily use contact groups the query can be very " "expensive." msgstr "" -#: src/Module/Admin/Site.php:547 +#: src/Module/Admin/Site.php:500 msgid "Maximum number of parallel workers" msgstr "" -#: src/Module/Admin/Site.php:547 +#: src/Module/Admin/Site.php:500 #, php-format msgid "" "On shared hosters set this to %d. On larger systems, values of %d are great. " "Default value is %d." msgstr "" -#: src/Module/Admin/Site.php:548 +#: src/Module/Admin/Site.php:501 msgid "Enable fastlane" msgstr "" -#: src/Module/Admin/Site.php:548 +#: src/Module/Admin/Site.php:501 msgid "" "When enabed, the fastlane mechanism starts an additional worker if processes " "with higher priority are blocked by processes of lower priority." msgstr "" -#: src/Module/Admin/Site.php:550 +#: src/Module/Admin/Site.php:503 msgid "Direct relay transfer" msgstr "" -#: src/Module/Admin/Site.php:550 +#: src/Module/Admin/Site.php:503 msgid "" "Enables the direct transfer to other servers without using the relay servers" msgstr "" -#: src/Module/Admin/Site.php:551 +#: src/Module/Admin/Site.php:504 msgid "Relay scope" msgstr "" -#: src/Module/Admin/Site.php:551 +#: src/Module/Admin/Site.php:504 msgid "" "Can be \"all\" or \"tags\". \"all\" means that every public post should be " "received. \"tags\" means that only posts with selected tags should be " "received." msgstr "" -#: src/Module/Admin/Site.php:551 src/Module/Contact/Profile.php:287 +#: src/Module/Admin/Site.php:504 src/Module/Contact/Profile.php:287 #: src/Module/Settings/TwoFactor/Index.php:125 msgid "Disabled" msgstr "" -#: src/Module/Admin/Site.php:551 +#: src/Module/Admin/Site.php:504 msgid "all" msgstr "" -#: src/Module/Admin/Site.php:551 +#: src/Module/Admin/Site.php:504 msgid "tags" msgstr "" -#: src/Module/Admin/Site.php:552 +#: src/Module/Admin/Site.php:505 msgid "Server tags" msgstr "" -#: src/Module/Admin/Site.php:552 +#: src/Module/Admin/Site.php:505 msgid "Comma separated list of tags for the \"tags\" subscription." msgstr "" -#: src/Module/Admin/Site.php:553 +#: src/Module/Admin/Site.php:506 msgid "Deny Server tags" msgstr "" -#: src/Module/Admin/Site.php:553 +#: src/Module/Admin/Site.php:506 msgid "Comma separated list of tags that are rejected." msgstr "" -#: src/Module/Admin/Site.php:554 +#: src/Module/Admin/Site.php:507 msgid "Allow user tags" msgstr "" -#: src/Module/Admin/Site.php:554 +#: src/Module/Admin/Site.php:507 msgid "" "If enabled, the tags from the saved searches will used for the \"tags\" " "subscription in addition to the \"relay_server_tags\"." msgstr "" -#: src/Module/Admin/Site.php:557 +#: src/Module/Admin/Site.php:510 msgid "Start Relocation" msgstr "" @@ -5062,18 +5042,25 @@ msgid "" "(Some of the errors are possibly inside the logfile.)" msgstr "" -#: src/Module/Admin/Summary.php:103 +#: src/Module/Admin/Summary.php:102 +msgid "" +"The system.url entry is missing. This is a low level setting and can lead to " +"unexpected behavior. Please add a valid entry as soon as possible in the " +"config file or per console command!" +msgstr "" + +#: src/Module/Admin/Summary.php:107 msgid "The worker was never executed. Please check your database structure!" msgstr "" -#: src/Module/Admin/Summary.php:105 +#: src/Module/Admin/Summary.php:109 #, php-format msgid "" "The last worker execution was on %s UTC. This is older than one hour. Please " "check your crontab settings." msgstr "" -#: src/Module/Admin/Summary.php:110 +#: src/Module/Admin/Summary.php:114 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5082,7 +5069,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:114 +#: src/Module/Admin/Summary.php:118 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5091,7 +5078,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:120 +#: src/Module/Admin/Summary.php:124 #, php-format msgid "" "%s is not reachable on your system. This is a severe " @@ -5099,50 +5086,50 @@ msgid "" "href=\"%s\">the installation page for help." msgstr "" -#: src/Module/Admin/Summary.php:138 +#: src/Module/Admin/Summary.php:142 #, php-format msgid "The logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:152 +#: src/Module/Admin/Summary.php:156 #, php-format msgid "The debug logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:168 +#: src/Module/Admin/Summary.php:172 #, php-format msgid "" "Friendica's system.basepath was updated from '%s' to '%s'. Please remove the " "system.basepath from your db to avoid differences." msgstr "" -#: src/Module/Admin/Summary.php:176 +#: src/Module/Admin/Summary.php:180 #, php-format msgid "" "Friendica's current system.basepath '%s' is wrong and the config file '%s' " "isn't used." msgstr "" -#: src/Module/Admin/Summary.php:184 +#: src/Module/Admin/Summary.php:188 #, php-format msgid "" "Friendica's current system.basepath '%s' is not equal to the config file " "'%s'. Please fix your configuration." msgstr "" -#: src/Module/Admin/Summary.php:195 +#: src/Module/Admin/Summary.php:199 msgid "Message queues" msgstr "" -#: src/Module/Admin/Summary.php:201 +#: src/Module/Admin/Summary.php:205 msgid "Server Settings" msgstr "" -#: src/Module/Admin/Summary.php:219 +#: src/Module/Admin/Summary.php:223 msgid "Version" msgstr "" -#: src/Module/Admin/Summary.php:223 +#: src/Module/Admin/Summary.php:227 msgid "Active addons" msgstr "" @@ -5528,12 +5515,12 @@ msgstr "" #: src/Module/Calendar/Event/Form.php:209 #: src/Module/Calendar/Event/Form.php:237 src/Module/Debug/Probe.php:59 -#: src/Module/Install.php:207 src/Module/Install.php:240 -#: src/Module/Install.php:245 src/Module/Install.php:264 -#: src/Module/Install.php:275 src/Module/Install.php:280 -#: src/Module/Install.php:286 src/Module/Install.php:291 -#: src/Module/Install.php:305 src/Module/Install.php:320 -#: src/Module/Install.php:347 +#: src/Module/Install.php:201 src/Module/Install.php:227 +#: src/Module/Install.php:232 src/Module/Install.php:246 +#: src/Module/Install.php:255 src/Module/Install.php:260 +#: src/Module/Install.php:266 src/Module/Install.php:271 +#: src/Module/Install.php:285 src/Module/Install.php:298 +#: src/Module/Install.php:325 #: src/Module/Moderation/Blocklist/Server/Add.php:136 #: src/Module/Moderation/Blocklist/Server/Add.php:138 #: src/Module/Moderation/Blocklist/Server/Import.php:129 @@ -6846,159 +6833,148 @@ msgstr "" msgid "Welcome to %s" msgstr "" -#: src/Module/Install.php:195 +#: src/Module/Install.php:189 msgid "Friendica Communications Server - Setup" msgstr "" -#: src/Module/Install.php:206 +#: src/Module/Install.php:200 msgid "System check" msgstr "" -#: src/Module/Install.php:208 src/Module/Install.php:265 -#: src/Module/Install.php:348 +#: src/Module/Install.php:202 src/Module/Install.php:247 +#: src/Module/Install.php:326 msgid "Requirement not satisfied" msgstr "" -#: src/Module/Install.php:209 +#: src/Module/Install.php:203 msgid "Optional requirement not satisfied" msgstr "" -#: src/Module/Install.php:210 +#: src/Module/Install.php:204 msgid "OK" msgstr "" -#: src/Module/Install.php:214 +#: src/Module/Install.php:208 msgid "Next" msgstr "" -#: src/Module/Install.php:215 +#: src/Module/Install.php:209 msgid "Check again" msgstr "" -#: src/Module/Install.php:230 +#: src/Module/Install.php:222 msgid "Base settings" msgstr "" -#: src/Module/Install.php:237 -msgid "Host name" -msgstr "" - -#: src/Module/Install.php:239 -msgid "" -"Overwrite this field in case the determinated hostname isn't right, " -"otherweise leave it as is." -msgstr "" - -#: src/Module/Install.php:242 +#: src/Module/Install.php:224 msgid "Base path to installation" msgstr "" -#: src/Module/Install.php:244 +#: src/Module/Install.php:226 msgid "" "If the system cannot detect the correct path to your installation, enter the " "correct path here. This setting should only be set if you are using a " "restricted system and symbolic links to your webroot." msgstr "" -#: src/Module/Install.php:247 -msgid "Sub path of the URL" +#: src/Module/Install.php:229 +msgid "The Friendica system URL" msgstr "" -#: src/Module/Install.php:249 +#: src/Module/Install.php:231 msgid "" -"Overwrite this field in case the sub path determination isn't right, " -"otherwise leave it as is. Leaving this field blank means the installation is " -"at the base URL without sub path." +"Overwrite this field in case the system URL determination isn't right, " +"otherwise leave it as is." msgstr "" -#: src/Module/Install.php:260 +#: src/Module/Install.php:242 msgid "Database connection" msgstr "" -#: src/Module/Install.php:261 +#: src/Module/Install.php:243 msgid "" "In order to install Friendica we need to know how to connect to your " "database." msgstr "" -#: src/Module/Install.php:262 +#: src/Module/Install.php:244 msgid "" "Please contact your hosting provider or site administrator if you have " "questions about these settings." msgstr "" -#: src/Module/Install.php:263 +#: src/Module/Install.php:245 msgid "" "The database you specify below should already exist. If it does not, please " "create it before continuing." msgstr "" -#: src/Module/Install.php:272 +#: src/Module/Install.php:252 msgid "Database Server Name" msgstr "" -#: src/Module/Install.php:277 +#: src/Module/Install.php:257 msgid "Database Login Name" msgstr "" -#: src/Module/Install.php:283 +#: src/Module/Install.php:263 msgid "Database Login Password" msgstr "" -#: src/Module/Install.php:285 +#: src/Module/Install.php:265 msgid "For security reasons the password must not be empty" msgstr "" -#: src/Module/Install.php:288 +#: src/Module/Install.php:268 msgid "Database Name" msgstr "" -#: src/Module/Install.php:292 src/Module/Install.php:322 +#: src/Module/Install.php:272 src/Module/Install.php:300 msgid "Please select a default timezone for your website" msgstr "" -#: src/Module/Install.php:307 +#: src/Module/Install.php:287 msgid "Site settings" msgstr "" -#: src/Module/Install.php:317 +#: src/Module/Install.php:295 msgid "Site administrator email address" msgstr "" -#: src/Module/Install.php:319 +#: src/Module/Install.php:297 msgid "" "Your account email address must match this in order to use the web admin " "panel." msgstr "" -#: src/Module/Install.php:326 +#: src/Module/Install.php:304 msgid "System Language:" msgstr "" -#: src/Module/Install.php:328 +#: src/Module/Install.php:306 msgid "" "Set the default language for your Friendica installation interface and to " "send emails." msgstr "" -#: src/Module/Install.php:340 +#: src/Module/Install.php:318 msgid "Your Friendica site database has been installed." msgstr "" -#: src/Module/Install.php:350 +#: src/Module/Install.php:328 msgid "Installation finished" msgstr "" -#: src/Module/Install.php:370 +#: src/Module/Install.php:348 msgid "

    What next

    " msgstr "" -#: src/Module/Install.php:371 +#: src/Module/Install.php:349 msgid "" "IMPORTANT: You will need to [manually] setup a scheduled task for the worker." msgstr "" -#: src/Module/Install.php:374 +#: src/Module/Install.php:352 #, php-format msgid "" "Go to your new Friendica node registration page " diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index abdabbcc8..ecd8ce277 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -24,8 +24,7 @@ {{include file="field_select.tpl" field=$language}} {{include file="field_select.tpl" field=$theme}} {{include file="field_select.tpl" field=$theme_mobile}} - {{include file="field_select.tpl" field=$ssl_policy}} - {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}} + {{include file="field_checkbox.tpl" field=$force_ssl}} {{include file="field_checkbox.tpl" field=$show_help}} {{include file="field_select.tpl" field=$singleuser}}
    diff --git a/view/templates/install_checks.tpl b/view/templates/install/01_checks.tpl similarity index 100% rename from view/templates/install_checks.tpl rename to view/templates/install/01_checks.tpl diff --git a/view/templates/install_base.tpl b/view/templates/install/02_base_config.tpl similarity index 64% rename from view/templates/install_base.tpl rename to view/templates/install/02_base_config.tpl index a8a6c0ab9..27f4b78a7 100644 --- a/view/templates/install_base.tpl +++ b/view/templates/install/02_base_config.tpl @@ -7,18 +7,14 @@ {{$info_03}}

    -
    + - {{include file="field_select.tpl" field=$ssl_policy}} -
    - {{include file="field_input.tpl" field=$hostname}} -
    {{include file="field_input.tpl" field=$basepath}}
    - {{include file="field_input.tpl" field=$urlpath}} + {{include file="field_input.tpl" field=$system_url}} diff --git a/view/templates/install_db.tpl b/view/templates/install/03_database_config.tpl similarity index 75% rename from view/templates/install_db.tpl rename to view/templates/install/03_database_config.tpl index e41975a94..a5f6f5806 100644 --- a/view/templates/install_db.tpl +++ b/view/templates/install/03_database_config.tpl @@ -19,13 +19,11 @@ {{/foreach}} - + - - - + {{include file="field_input.tpl" field=$dbhost}} diff --git a/view/templates/install_settings.tpl b/view/templates/install/04_site_settings.tpl similarity index 74% rename from view/templates/install_settings.tpl rename to view/templates/install/04_site_settings.tpl index ff857f4c0..b71f69f01 100644 --- a/view/templates/install_settings.tpl +++ b/view/templates/install/04_site_settings.tpl @@ -4,13 +4,11 @@

    {{$pass}}

    - + - - - + diff --git a/view/templates/install_finished.tpl b/view/templates/install/05_finished.tpl similarity index 100% rename from view/templates/install_finished.tpl rename to view/templates/install/05_finished.tpl diff --git a/view/templates/local.config.tpl b/view/templates/install/local.config.tpl similarity index 85% rename from view/templates/local.config.tpl rename to view/templates/install/local.config.tpl index 24b33b8cd..753698a3f 100644 --- a/view/templates/local.config.tpl +++ b/view/templates/install/local.config.tpl @@ -24,14 +24,11 @@ return [ 'php_path' => '{{$phpath|escape:'quotes' nofilter}}', 'admin_email' => '{{$adminmail|escape:'quotes' nofilter}}', 'sitename' => 'Friendica Social Network', - 'hostname' => '{{$hostname|escape:'quotes' nofilter}}', 'register_policy' => \Friendica\Module\Register::OPEN, 'max_import_size' => 200000, ], 'system' => [ - 'urlpath' => '{{$urlpath|escape:'quotes' nofilter}}', - 'url' => '{{$baseurl|escape:'quotes' nofilter}}', - 'ssl_policy' => {{$sslpolicy|escape:'quotes' nofilter}}, + 'url' => '{{$system_url|escape:'quotes' nofilter}}', 'basepath' => '{{$basepath|escape:'quotes' nofilter}}', 'default_timezone' => '{{$timezone|escape:'quotes' nofilter}}', 'language' => '{{$language|escape:'quotes' nofilter}}', diff --git a/view/theme/frio/php/default.php b/view/theme/frio/php/default.php index c6092393b..0677ff900 100644 --- a/view/theme/frio/php/default.php +++ b/view/theme/frio/php/default.php @@ -35,7 +35,7 @@ if (!isset($minimal)) { $minimal = false; } -$basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/"; +$basepath = DI::baseUrl()->getPath() ? "/" . DI::baseUrl()->getPath() . "/" : "/"; $frio = "view/theme/frio"; $view_mode_class = (DI::mode()->isMobile() || DI::mode()->isMobile()) ? 'mobile-view' : 'desktop-view'; $is_singleuser = DI::config()->get('system', 'singleuser'); diff --git a/view/theme/frio/templates/admin/site.tpl b/view/theme/frio/templates/admin/site.tpl index 05a25f6cb..92dd1796f 100644 --- a/view/theme/frio/templates/admin/site.tpl +++ b/view/theme/frio/templates/admin/site.tpl @@ -45,8 +45,7 @@ {{include file="field_select.tpl" field=$language}} {{include file="field_select.tpl" field=$theme}} {{include file="field_select.tpl" field=$theme_mobile}} - {{include file="field_select.tpl" field=$ssl_policy}} - {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}} + {{include file="field_checkbox.tpl" field=$force_ssl}} {{include file="field_checkbox.tpl" field=$show_help}} {{include file="field_select.tpl" field=$singleuser}} diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index 994fe8c85..f56aa30f9 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -1,4 +1,26 @@ . + * + * Name: smoothly + * + * BEWARE: currently UNSUPPORTED + */ /* * Name: Smoothly @@ -23,7 +45,7 @@ function smoothly_init(App $a) { $cssFile = null; $ssl_state = false; - $baseurl = DI::baseUrl()->get($ssl_state); + $baseurl = DI::baseUrl(); DI::page()['htmlhead'] .= <<< EOT