Merge pull request #7517 from nupplaphil/task/prepare_app
Prepare App for further usage
This commit is contained in:
commit
258c8bd905
15 changed files with 200 additions and 181 deletions
162
src/App.php
162
src/App.php
|
@ -9,6 +9,7 @@ use DOMDocument;
|
||||||
use DOMXPath;
|
use DOMXPath;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Friendica\App\Arguments;
|
use Friendica\App\Arguments;
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Core\Config\Cache\ConfigCache;
|
use Friendica\Core\Config\Cache\ConfigCache;
|
||||||
use Friendica\Core\Config\Configuration;
|
use Friendica\Core\Config\Configuration;
|
||||||
use Friendica\Core\Config\PConfiguration;
|
use Friendica\Core\Config\PConfiguration;
|
||||||
|
@ -16,12 +17,10 @@ use Friendica\Core\L10n\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Database\DBA;
|
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\ConfigFileLoader;
|
use Friendica\Util\ConfigFileLoader;
|
||||||
use Friendica\Util\HTTPSignature;
|
use Friendica\Util\HTTPSignature;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
|
@ -44,8 +43,8 @@ use Psr\Log\LoggerInterface;
|
||||||
class App
|
class App
|
||||||
{
|
{
|
||||||
/** @deprecated 2019.09 - use App\Arguments->getQueryString() */
|
/** @deprecated 2019.09 - use App\Arguments->getQueryString() */
|
||||||
public $query_string = '';
|
public $query_string;
|
||||||
public $page = [];
|
public $page;
|
||||||
public $profile;
|
public $profile;
|
||||||
public $profile_uid;
|
public $profile_uid;
|
||||||
public $user;
|
public $user;
|
||||||
|
@ -66,8 +65,8 @@ class App
|
||||||
public $timezone;
|
public $timezone;
|
||||||
public $interactive = true;
|
public $interactive = true;
|
||||||
public $identities;
|
public $identities;
|
||||||
public $is_mobile = false;
|
public $is_mobile;
|
||||||
public $is_tablet = false;
|
public $is_tablet;
|
||||||
public $theme_info = [];
|
public $theme_info = [];
|
||||||
public $category;
|
public $category;
|
||||||
// Allow themes to control internal parameters
|
// Allow themes to control internal parameters
|
||||||
|
@ -218,9 +217,10 @@ class App
|
||||||
* Inclusion is done in App->initHead().
|
* Inclusion is done in App->initHead().
|
||||||
* The path can be absolute or relative to the Friendica installation base folder.
|
* The path can be absolute or relative to the Friendica installation base folder.
|
||||||
*
|
*
|
||||||
|
* @param string $path
|
||||||
|
*
|
||||||
* @see initHead()
|
* @see initHead()
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
*/
|
*/
|
||||||
public function registerStylesheet($path)
|
public function registerStylesheet($path)
|
||||||
{
|
{
|
||||||
|
@ -236,9 +236,10 @@ class App
|
||||||
* Inclusion is done in App->initFooter().
|
* Inclusion is done in App->initFooter().
|
||||||
* The path can be absolute or relative to the Friendica installation base folder.
|
* The path can be absolute or relative to the Friendica installation base folder.
|
||||||
*
|
*
|
||||||
|
* @param string $path
|
||||||
|
*
|
||||||
* @see initFooter()
|
* @see initFooter()
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
*/
|
*/
|
||||||
public function registerFooterScript($path)
|
public function registerFooterScript($path)
|
||||||
{
|
{
|
||||||
|
@ -250,8 +251,6 @@ class App
|
||||||
public $queue;
|
public $queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief App constructor.
|
|
||||||
*
|
|
||||||
* @param Database $database The Friendica Database
|
* @param Database $database The Friendica Database
|
||||||
* @param Configuration $config The Configuration
|
* @param Configuration $config The Configuration
|
||||||
* @param App\Mode $mode The mode of this Friendica app
|
* @param App\Mode $mode The mode of this Friendica app
|
||||||
|
@ -260,10 +259,10 @@ class App
|
||||||
* @param LoggerInterface $logger The current app logger
|
* @param LoggerInterface $logger The current app logger
|
||||||
* @param Profiler $profiler The profiler of this application
|
* @param Profiler $profiler The profiler of this application
|
||||||
* @param L10n $l10n The translator instance
|
* @param L10n $l10n The translator instance
|
||||||
*
|
* @param App\Arguments $args The Friendica Arguments of the call
|
||||||
* @throws Exception if the Basepath is not usable
|
* @param MobileDetect $mobileDetect A mobile detection class
|
||||||
*/
|
*/
|
||||||
public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args)
|
public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, App\Module $module, MobileDetect $mobileDetect)
|
||||||
{
|
{
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -274,11 +273,40 @@ class App
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
|
$this->mobileDetect = $mobileDetect;
|
||||||
|
|
||||||
$this->profiler->reset();
|
$this->cmd = $args->getCommand();
|
||||||
|
$this->argv = $args->getArgv();
|
||||||
|
$this->argc = $args->getArgc();
|
||||||
|
$this->query_string = $args->getQueryString();
|
||||||
|
$this->module = $module->getName();
|
||||||
|
|
||||||
$this->reload();
|
$this->is_mobile = $mobileDetect->isMobile();
|
||||||
|
$this->is_tablet = $mobileDetect->isTablet();
|
||||||
|
|
||||||
|
$this->isAjax = strtolower(defaults($_SERVER, 'HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest';
|
||||||
|
|
||||||
|
$this->page = [
|
||||||
|
'aside' => '',
|
||||||
|
'bottom' => '',
|
||||||
|
'content' => '',
|
||||||
|
'footer' => '',
|
||||||
|
'htmlhead' => '',
|
||||||
|
'nav' => '',
|
||||||
|
'page_title' => '',
|
||||||
|
'right_aside' => '',
|
||||||
|
'template' => '',
|
||||||
|
'title' => ''
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the whole app instance
|
||||||
|
*/
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
// This has to be quite large to deal with embedded private photos
|
// This has to be quite large to deal with embedded private photos
|
||||||
|
@ -290,31 +318,9 @@ class App
|
||||||
. $this->getBasePath() . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
|
. $this->getBasePath() . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
|
||||||
. $this->getBasePath());
|
. $this->getBasePath());
|
||||||
|
|
||||||
$this->cmd = $args->getCommand();
|
$this->profiler->reset();
|
||||||
$this->argv = $args->getArgv();
|
|
||||||
$this->argc = $args->getArgc();
|
|
||||||
$this->query_string = $args->getQueryString();
|
|
||||||
|
|
||||||
// Detect mobile devices
|
if ($this->mode->has(App\Mode::DBAVAILABLE)) {
|
||||||
$mobile_detect = new MobileDetect();
|
|
||||||
|
|
||||||
$this->mobileDetect = $mobile_detect;
|
|
||||||
|
|
||||||
$this->is_mobile = $mobile_detect->isMobile();
|
|
||||||
$this->is_tablet = $mobile_detect->isTablet();
|
|
||||||
|
|
||||||
$this->isAjax = strtolower(defaults($_SERVER, 'HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest';
|
|
||||||
|
|
||||||
// Register template engines
|
|
||||||
Core\Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reloads the whole app instance
|
|
||||||
*/
|
|
||||||
public function reload()
|
|
||||||
{
|
|
||||||
if ($this->getMode()->has(App\Mode::DBAVAILABLE)) {
|
|
||||||
$this->profiler->update($this->config);
|
$this->profiler->update($this->config);
|
||||||
|
|
||||||
Core\Hook::loadHooks();
|
Core\Hook::loadHooks();
|
||||||
|
@ -323,6 +329,8 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->loadDefaultTimezone();
|
$this->loadDefaultTimezone();
|
||||||
|
// Register template engines
|
||||||
|
Core\Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,6 +356,7 @@ class App
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the scheme of the current call
|
* Returns the scheme of the current call
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @deprecated 2019.06 - use BaseURL->getScheme() instead
|
* @deprecated 2019.06 - use BaseURL->getScheme() instead
|
||||||
|
@ -528,21 +537,13 @@ class App
|
||||||
* @param string $origURL
|
* @param string $origURL
|
||||||
*
|
*
|
||||||
* @return string The cleaned url
|
* @return string The cleaned url
|
||||||
* @throws HTTPException\InternalServerErrorException
|
*
|
||||||
|
* @deprecated 2019.09 - Use BaseURL->remove() instead
|
||||||
|
* @see BaseURL::remove()
|
||||||
*/
|
*/
|
||||||
public function removeBaseURL($origURL)
|
public function removeBaseURL($origURL)
|
||||||
{
|
{
|
||||||
// Remove the hostname from the url if it is an internal link
|
return $this->baseURL->remove($origURL);
|
||||||
$nurl = Util\Strings::normaliseLink($origURL);
|
|
||||||
$base = Util\Strings::normaliseLink($this->getBaseURL());
|
|
||||||
$url = str_replace($base . '/', '', $nurl);
|
|
||||||
|
|
||||||
// if it is an external link return the orignal value
|
|
||||||
if ($url == Util\Strings::normaliseLink($origURL)) {
|
|
||||||
return $origURL;
|
|
||||||
} else {
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -604,10 +605,10 @@ class App
|
||||||
|
|
||||||
$processlist = DBA::processlist();
|
$processlist = DBA::processlist();
|
||||||
if ($processlist['list'] != '') {
|
if ($processlist['list'] != '') {
|
||||||
Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], Core\Logger::DEBUG);
|
$this->logger->debug('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list']);
|
||||||
|
|
||||||
if ($processlist['amount'] > $max_processes) {
|
if ($processlist['amount'] > $max_processes) {
|
||||||
Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', Core\Logger::DEBUG);
|
$this->logger->debug('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -654,7 +655,7 @@ class App
|
||||||
$reached = ($free < $min_memory);
|
$reached = ($free < $min_memory);
|
||||||
|
|
||||||
if ($reached) {
|
if ($reached) {
|
||||||
Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, Core\Logger::DEBUG);
|
$this->logger->debug('Minimal memory reached.', ['free' => $free, 'memtotal' => $meminfo['MemTotal'], 'limit' => $min_memory]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reached;
|
return $reached;
|
||||||
|
@ -668,7 +669,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function isMaxLoadReached()
|
public function isMaxLoadReached()
|
||||||
{
|
{
|
||||||
if ($this->isBackend()) {
|
if ($this->mode->isBackend()) {
|
||||||
$process = 'backend';
|
$process = 'backend';
|
||||||
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
|
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
|
||||||
if ($maxsysload < 1) {
|
if ($maxsysload < 1) {
|
||||||
|
@ -685,7 +686,7 @@ class App
|
||||||
$load = Core\System::currentLoad();
|
$load = Core\System::currentLoad();
|
||||||
if ($load) {
|
if ($load) {
|
||||||
if (intval($load) > $maxsysload) {
|
if (intval($load) > $maxsysload) {
|
||||||
Core\Logger::log('system: load ' . $load . ' for ' . $process . ' tasks (' . $maxsysload . ') too high.');
|
$this->logger->info('system load for process too high.', ['load' => $load, 'process' => $process, 'maxsysload' => $maxsysload]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -697,6 +698,7 @@ class App
|
||||||
*
|
*
|
||||||
* @param string $command The command to execute
|
* @param string $command The command to execute
|
||||||
* @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
|
* @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
|
||||||
|
*
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function proc_run($command, $args)
|
public function proc_run($command, $args)
|
||||||
|
@ -728,7 +730,7 @@ class App
|
||||||
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
|
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
|
||||||
}
|
}
|
||||||
if (!is_resource($resource)) {
|
if (!is_resource($resource)) {
|
||||||
Core\Logger::log('We got no resource for command ' . $cmdline, Core\Logger::DEBUG);
|
$this->logger->debug('We got no resource for command.', ['cmd' => $cmdline]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
proc_close($resource);
|
proc_close($resource);
|
||||||
|
@ -763,7 +765,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function getCurrentTheme()
|
public function getCurrentTheme()
|
||||||
{
|
{
|
||||||
if ($this->getMode()->isInstall()) {
|
if ($this->mode->isInstall()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,8 +801,8 @@ class App
|
||||||
if ($this->profile_uid && ($this->profile_uid != local_user())) {
|
if ($this->profile_uid && ($this->profile_uid != local_user())) {
|
||||||
// Allow folks to override user themes and always use their own on their own site.
|
// Allow folks to override user themes and always use their own on their own site.
|
||||||
// This works only if the user is on the same server
|
// This works only if the user is on the same server
|
||||||
$user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
|
$user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
|
||||||
if (DBA::isResult($user) && !Core\PConfig::get(local_user(), 'system', 'always_my_theme')) {
|
if ($this->database->isResult($user) && !Core\PConfig::get(local_user(), 'system', 'always_my_theme')) {
|
||||||
$page_theme = $user['theme'];
|
$page_theme = $user['theme'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,7 +904,7 @@ class App
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Missing DB connection: ERROR
|
// Missing DB connection: ERROR
|
||||||
if ($this->getMode()->has(App\Mode::LOCALCONFIGPRESENT) && !$this->getMode()->has(App\Mode::DBAVAILABLE)) {
|
if ($this->mode->has(App\Mode::LOCALCONFIGPRESENT) && !$this->mode->has(App\Mode::DBAVAILABLE)) {
|
||||||
throw new HTTPException\InternalServerErrorException('Apologies but the website is unavailable at the moment.');
|
throw new HTTPException\InternalServerErrorException('Apologies but the website is unavailable at the moment.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,7 +916,7 @@ class App
|
||||||
throw new HTTPException\ServiceUnavailableException('The node is currently overloaded. Please try again later.');
|
throw new HTTPException\ServiceUnavailableException('The node is currently overloaded. Please try again later.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->getMode()->isInstall()) {
|
if (!$this->mode->isInstall()) {
|
||||||
// Force SSL redirection
|
// Force SSL redirection
|
||||||
if ($this->baseURL->checkRedirectHttps()) {
|
if ($this->baseURL->checkRedirectHttps()) {
|
||||||
System::externalRedirect($this->baseURL->get() . '/' . $this->args->getQueryString());
|
System::externalRedirect($this->baseURL->get() . '/' . $this->args->getQueryString());
|
||||||
|
@ -925,7 +927,7 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exclude the backend processes from the session management
|
// Exclude the backend processes from the session management
|
||||||
if (!$this->isBackend()) {
|
if (!$this->mode->isBackend()) {
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
session_start();
|
session_start();
|
||||||
$this->profiler->saveTimestamp($stamp1, 'parser', Core\System::callstack());
|
$this->profiler->saveTimestamp($stamp1, 'parser', Core\System::callstack());
|
||||||
|
@ -936,7 +938,7 @@ class App
|
||||||
Core\Worker::executeIfIdle();
|
Core\Worker::executeIfIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getMode()->isNormal()) {
|
if ($this->mode->isNormal()) {
|
||||||
$requester = HTTPSignature::getSigner('', $_SERVER);
|
$requester = HTTPSignature::getSigner('', $_SERVER);
|
||||||
if (!empty($requester)) {
|
if (!empty($requester)) {
|
||||||
Profile::addVisitorCookieForHandle($requester);
|
Profile::addVisitorCookieForHandle($requester);
|
||||||
|
@ -944,7 +946,7 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZRL
|
// ZRL
|
||||||
if (!empty($_GET['zrl']) && $this->getMode()->isNormal()) {
|
if (!empty($_GET['zrl']) && $this->mode->isNormal()) {
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
// Only continue when the given profile link seems valid
|
// Only continue when the given profile link seems valid
|
||||||
// Valid profile links contain a path with "/profile/" and no query parameters
|
// Valid profile links contain a path with "/profile/" and no query parameters
|
||||||
|
@ -959,13 +961,13 @@ class App
|
||||||
} else {
|
} else {
|
||||||
// Someone came with an invalid parameter, maybe as a DDoS attempt
|
// Someone came with an invalid parameter, maybe as a DDoS attempt
|
||||||
// We simply stop processing here
|
// We simply stop processing here
|
||||||
Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], Core\Logger::DEBUG);
|
$this->logger->debug('Invalid ZRL parameter.', ['zrl' => $_GET['zrl']]);
|
||||||
throw new HTTPException\ForbiddenException();
|
throw new HTTPException\ForbiddenException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET['owt']) && $this->getMode()->isNormal()) {
|
if (!empty($_GET['owt']) && $this->mode->isNormal()) {
|
||||||
$token = $_GET['owt'];
|
$token = $_GET['owt'];
|
||||||
Model\Profile::openWebAuthInit($token);
|
Model\Profile::openWebAuthInit($token);
|
||||||
}
|
}
|
||||||
|
@ -988,30 +990,17 @@ class App
|
||||||
|
|
||||||
// in install mode, any url loads install module
|
// in install mode, any url loads install module
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if ($this->getMode()->isInstall() && $moduleName !== 'install') {
|
if ($this->mode->isInstall() && $moduleName !== 'install') {
|
||||||
$this->internalRedirect('install');
|
$this->internalRedirect('install');
|
||||||
} elseif (!$this->getMode()->isInstall() && !$this->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
|
} elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
|
||||||
$this->internalRedirect('maintenance');
|
$this->internalRedirect('maintenance');
|
||||||
} else {
|
} else {
|
||||||
$this->checkURL();
|
$this->checkURL();
|
||||||
Core\Update::check($this->getBasePath(), false, $this->getMode());
|
Core\Update::check($this->getBasePath(), false, $this->mode);
|
||||||
Core\Addon::loadAddons();
|
Core\Addon::loadAddons();
|
||||||
Core\Hook::loadHooks();
|
Core\Hook::loadHooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->page = [
|
|
||||||
'aside' => '',
|
|
||||||
'bottom' => '',
|
|
||||||
'content' => '',
|
|
||||||
'footer' => '',
|
|
||||||
'htmlhead' => '',
|
|
||||||
'nav' => '',
|
|
||||||
'page_title' => '',
|
|
||||||
'right_aside' => '',
|
|
||||||
'template' => '',
|
|
||||||
'title' => ''
|
|
||||||
];
|
|
||||||
|
|
||||||
// Compatibility with the Android Diaspora client
|
// Compatibility with the Android Diaspora client
|
||||||
if ($moduleName == 'stream') {
|
if ($moduleName == 'stream') {
|
||||||
$this->internalRedirect('network?order=post');
|
$this->internalRedirect('network?order=post');
|
||||||
|
@ -1075,7 +1064,7 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialise content region
|
// initialise content region
|
||||||
if ($this->getMode()->isNormal()) {
|
if ($this->mode->isNormal()) {
|
||||||
Core\Hook::callAll('page_content_top', $this->page['content']);
|
Core\Hook::callAll('page_content_top', $this->page['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,7 +1132,7 @@ class App
|
||||||
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
||||||
header("Content-type: text/html; charset=utf-8");
|
header("Content-type: text/html; charset=utf-8");
|
||||||
|
|
||||||
if ($this->config->get('system', 'hsts') && ($this->baseURL->getSSLPolicy() == BaseUrl::SSL_POLICY_FULL)) {
|
if ($this->config->get('system', 'hsts') && ($this->baseURL->getSSLPolicy() == BaseURL::SSL_POLICY_FULL)) {
|
||||||
header("Strict-Transport-Security: max-age=31536000");
|
header("Strict-Transport-Security: max-age=31536000");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,7 +1183,7 @@ class App
|
||||||
throw new HTTPException\InternalServerErrorException("'$toUrl is not a relative path, please use System::externalRedirectTo");
|
throw new HTTPException\InternalServerErrorException("'$toUrl is not a relative path, please use System::externalRedirectTo");
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirectTo = $this->getBaseURL($ssl) . '/' . ltrim($toUrl, '/');
|
$redirectTo = $this->baseURL->get($ssl) . '/' . ltrim($toUrl, '/');
|
||||||
Core\System::externalRedirect($redirectTo);
|
Core\System::externalRedirect($redirectTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,6 +1192,7 @@ class App
|
||||||
* Should only be used if it isn't clear if the URL is either internal or external
|
* Should only be used if it isn't clear if the URL is either internal or external
|
||||||
*
|
*
|
||||||
* @param string $toUrl The target URL
|
* @param string $toUrl The target URL
|
||||||
|
*
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function redirect($toUrl)
|
public function redirect($toUrl)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Friendica\Util;
|
namespace Friendica\App;
|
||||||
|
|
||||||
use Friendica\Core\Config\Configuration;
|
use Friendica\Core\Config\Configuration;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class which checks and contains the basic
|
* A class which checks and contains the basic
|
||||||
|
@ -32,48 +34,56 @@ class BaseURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Friendica Config
|
* The Friendica Config
|
||||||
|
*
|
||||||
* @var Configuration
|
* @var Configuration
|
||||||
*/
|
*/
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side variables
|
* The server side variables
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hostname of the Base URL
|
* The hostname of the Base URL
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $hostname;
|
private $hostname;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SSL_POLICY of the Base URL
|
* The SSL_POLICY of the Base URL
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $sslPolicy;
|
private $sslPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL sub-path of the Base URL
|
* The URL sub-path of the Base URL
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $urlPath;
|
private $urlPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The full URL
|
* The full URL
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $url;
|
private $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current scheme of this call
|
* The current scheme of this call
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $scheme;
|
private $scheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the hostname of this node
|
* Returns the hostname of this node
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getHostname()
|
public function getHostname()
|
||||||
|
@ -83,6 +93,7 @@ class BaseURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current scheme of this call
|
* Returns the current scheme of this call
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getScheme()
|
public function getScheme()
|
||||||
|
@ -92,6 +103,7 @@ class BaseURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SSL policy of this node
|
* Returns the SSL policy of this node
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSSLPolicy()
|
public function getSSLPolicy()
|
||||||
|
@ -101,6 +113,7 @@ class BaseURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the sub-path of this URL
|
* Returns the sub-path of this URL
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getUrlPath()
|
public function getUrlPath()
|
||||||
|
@ -229,12 +242,12 @@ class BaseURL
|
||||||
*/
|
*/
|
||||||
public function checkRedirectHttps()
|
public function checkRedirectHttps()
|
||||||
{
|
{
|
||||||
return $this->config->get('system', 'force_ssl')
|
return $this->config->get('system', 'force_ssl') &&
|
||||||
&& ($this->getScheme() == "http")
|
($this->getScheme() == "http") &&
|
||||||
&& intval($this->getSSLPolicy()) == BaseURL::SSL_POLICY_FULL
|
intval($this->getSSLPolicy()) == BaseURL::SSL_POLICY_FULL &&
|
||||||
&& strpos($this->get(), 'https://') === 0
|
strpos($this->get(), 'https://') === 0 &&
|
||||||
&& !empty($this->server['REQUEST_METHOD'])
|
!empty($this->server['REQUEST_METHOD']) &&
|
||||||
&& $this->server['REQUEST_METHOD'] === 'GET';
|
$this->server['REQUEST_METHOD'] === 'GET';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,4 +392,26 @@ class BaseURL
|
||||||
$this->scheme = 'https';
|
$this->scheme = 'https';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the base url from an url. This avoids some mixed content problems.
|
||||||
|
*
|
||||||
|
* @param string $origURL
|
||||||
|
*
|
||||||
|
* @return string The cleaned url
|
||||||
|
*/
|
||||||
|
public function remove(string $origURL)
|
||||||
|
{
|
||||||
|
// Remove the hostname from the url if it is an internal link
|
||||||
|
$nurl = Strings::normaliseLink($origURL);
|
||||||
|
$base = Strings::normaliseLink($this->get());
|
||||||
|
$url = str_replace($base . '/', '', $nurl);
|
||||||
|
|
||||||
|
// if it is an external link return the orignal value
|
||||||
|
if ($url == Strings::normaliseLink($origURL)) {
|
||||||
|
return $origURL;
|
||||||
|
} else {
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,12 +4,12 @@ namespace Friendica\Console;
|
||||||
|
|
||||||
use Asika\SimpleConsole\Console;
|
use Asika\SimpleConsole\Console;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Installer;
|
use Friendica\Core\Installer;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Util\BasePath;
|
use Friendica\Util\BasePath;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\ConfigFileLoader;
|
use Friendica\Util\ConfigFileLoader;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ namespace Friendica\Core;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Network\HTTPException\ForbiddenException;
|
use Friendica\Network\HTTPException\ForbiddenException;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Authentification, Session and Cookies
|
* Handle Authentification, Session and Cookies
|
||||||
|
@ -51,7 +50,7 @@ class Authentication extends BaseObject
|
||||||
$value = "";
|
$value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
setcookie("Friendica", $value, $time, "/", "", (Config::get('system', 'ssl_policy') == BaseUrl::SSL_POLICY_FULL), true);
|
setcookie("Friendica", $value, $time, "/", "", (Config::get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,9 +9,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\Session\CacheSessionHandler;
|
use Friendica\Core\Session\CacheSessionHandler;
|
||||||
use Friendica\Core\Session\DatabaseSessionHandler;
|
use Friendica\Core\Session\DatabaseSessionHandler;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +28,7 @@ class Session
|
||||||
ini_set('session.use_only_cookies', 1);
|
ini_set('session.use_only_cookies', 1);
|
||||||
ini_set('session.cookie_httponly', 1);
|
ini_set('session.cookie_httponly', 1);
|
||||||
|
|
||||||
if (Config::get('system', 'ssl_policy') == BaseURL::SSL_POLICY_FULL) {
|
if (Config::get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL) {
|
||||||
ini_set('session.cookie_secure', 1);
|
ini_set('session.cookie_secure', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Friendica\Factory;
|
namespace Friendica\Factory;
|
||||||
|
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Cache\ICache;
|
use Friendica\Core\Cache\ICache;
|
||||||
use Friendica\Core\Config\Configuration;
|
use Friendica\Core\Config\Configuration;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Model;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Content\Pager;
|
use Friendica\Content\Pager;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
@ -22,7 +23,6 @@ use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
|
@ -14,7 +14,6 @@ use Friendica\Module\BaseAdminModule;
|
||||||
use Friendica\Module\Register;
|
use Friendica\Module\Register;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Util\BasePath;
|
use Friendica\Util\BasePath;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Worker\Delivery;
|
use Friendica\Worker\Delivery;
|
||||||
|
|
||||||
|
@ -246,7 +245,7 @@ class Site extends BaseAdminModule
|
||||||
$diaspora_enabled = false;
|
$diaspora_enabled = false;
|
||||||
}
|
}
|
||||||
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
|
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
|
||||||
if ($ssl_policy == BaseURL::SSL_POLICY_FULL) {
|
if ($ssl_policy == App\BaseURL::SSL_POLICY_FULL) {
|
||||||
DBA::e("UPDATE `contact` SET
|
DBA::e("UPDATE `contact` SET
|
||||||
`url` = REPLACE(`url` , 'http:' , 'https:'),
|
`url` = REPLACE(`url` , 'http:' , 'https:'),
|
||||||
`photo` = REPLACE(`photo` , 'http:' , 'https:'),
|
`photo` = REPLACE(`photo` , 'http:' , 'https:'),
|
||||||
|
@ -264,7 +263,7 @@ class Site extends BaseAdminModule
|
||||||
`thumb` = REPLACE(`thumb` , 'http:' , 'https:')
|
`thumb` = REPLACE(`thumb` , 'http:' , 'https:')
|
||||||
WHERE 1 "
|
WHERE 1 "
|
||||||
);
|
);
|
||||||
} elseif ($ssl_policy == BaseURL::SSL_POLICY_SELFSIGN) {
|
} elseif ($ssl_policy == App\BaseURL::SSL_POLICY_SELFSIGN) {
|
||||||
DBA::e("UPDATE `contact` SET
|
DBA::e("UPDATE `contact` SET
|
||||||
`url` = REPLACE(`url` , 'https:' , 'http:'),
|
`url` = REPLACE(`url` , 'https:' , 'http:'),
|
||||||
`photo` = REPLACE(`photo` , 'https:' , 'http:'),
|
`photo` = REPLACE(`photo` , 'https:' , 'http:'),
|
||||||
|
@ -512,9 +511,9 @@ class Site extends BaseAdminModule
|
||||||
];
|
];
|
||||||
|
|
||||||
$ssl_choices = [
|
$ssl_choices = [
|
||||||
BaseURL::SSL_POLICY_NONE => L10n::t('No SSL policy, links will track page SSL state'),
|
App\BaseURL::SSL_POLICY_NONE => L10n::t('No SSL policy, links will track page SSL state'),
|
||||||
BaseURL::SSL_POLICY_FULL => L10n::t('Force all links to use SSL'),
|
App\BaseURL::SSL_POLICY_FULL => L10n::t('Force all links to use SSL'),
|
||||||
BaseURL::SSL_POLICY_SELFSIGN => L10n::t('Self-signed certificate, use SSL for local links only (discouraged)')
|
App\BaseURL::SSL_POLICY_SELFSIGN => L10n::t('Self-signed certificate, use SSL for local links only (discouraged)')
|
||||||
];
|
];
|
||||||
|
|
||||||
$check_git_version_choices = [
|
$check_git_version_choices = [
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Util\BasePath;
|
use Friendica\Util\BasePath;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
|
@ -180,9 +179,9 @@ class Install extends BaseModule
|
||||||
|
|
||||||
case self::BASE_CONFIG:
|
case self::BASE_CONFIG:
|
||||||
$ssl_choices = [
|
$ssl_choices = [
|
||||||
BaseURL::SSL_POLICY_NONE => L10n::t("No SSL policy, links will track page SSL state"),
|
App\BaseURL::SSL_POLICY_NONE => L10n::t("No SSL policy, links will track page SSL state"),
|
||||||
BaseURL::SSL_POLICY_FULL => L10n::t("Force all links to use SSL"),
|
App\BaseURL::SSL_POLICY_FULL => L10n::t("Force all links to use SSL"),
|
||||||
BaseURL::SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
|
App\BaseURL::SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
|
||||||
];
|
];
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('install_base.tpl');
|
$tpl = Renderer::getMarkupTemplate('install_base.tpl');
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace Friendica\Protocol;
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use DOMXPath;
|
use DOMXPath;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Content\OEmbed;
|
use Friendica\Content\OEmbed;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Content\Text\HTML;
|
use Friendica\Content\Text\HTML;
|
||||||
|
@ -31,7 +32,6 @@ use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
|
@ -85,12 +85,12 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
* Creates the Util\BaseURL
|
* Creates the App\BaseURL
|
||||||
*
|
*
|
||||||
* Same as:
|
* Same as:
|
||||||
* $baseURL = new Util\BaseURL($configuration, $_SERVER);
|
* $baseURL = new App\BaseURL($configuration, $_SERVER);
|
||||||
*/
|
*/
|
||||||
Util\BaseURL::class => [
|
App\BaseURL::class => [
|
||||||
'constructParams' => [
|
'constructParams' => [
|
||||||
$_SERVER,
|
$_SERVER,
|
||||||
],
|
],
|
||||||
|
|
|
@ -15,7 +15,6 @@ use Friendica\Test\Util\DBAMockTrait;
|
||||||
use Friendica\Test\Util\DBStructureMockTrait;
|
use Friendica\Test\Util\DBStructureMockTrait;
|
||||||
use Friendica\Test\Util\RendererMockTrait;
|
use Friendica\Test\Util\RendererMockTrait;
|
||||||
use Friendica\Test\Util\VFSTrait;
|
use Friendica\Test\Util\VFSTrait;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
use Friendica\Util\Logger\VoidLogger;
|
use Friendica\Util\Logger\VoidLogger;
|
||||||
use Mockery\MockInterface;
|
use Mockery\MockInterface;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
@ -353,7 +352,7 @@ FIN;
|
||||||
$this->assertConfigEntry('system', 'language', $assertion, ($default) ? Installer::DEFAULT_LANG : null);
|
$this->assertConfigEntry('system', 'language', $assertion, ($default) ? Installer::DEFAULT_LANG : null);
|
||||||
$this->assertConfigEntry('system', 'url', $assertion);
|
$this->assertConfigEntry('system', 'url', $assertion);
|
||||||
$this->assertConfigEntry('system', 'urlpath', $assertion);
|
$this->assertConfigEntry('system', 'urlpath', $assertion);
|
||||||
$this->assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? BaseURL::DEFAULT_SSL_SCHEME : null);
|
$this->assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? App\BaseURL::DEFAULT_SSL_SCHEME : null);
|
||||||
$this->assertConfigEntry('system', 'basepath', ($realBasepath) ? $this->root->url() : $assertion);
|
$this->assertConfigEntry('system', 'basepath', ($realBasepath) ? $this->root->url() : $assertion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Friendica\Test\src\Content\Text;
|
namespace Friendica\Test\src\Content\Text;
|
||||||
|
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\L10n\L10n;
|
use Friendica\Core\L10n\L10n;
|
||||||
use Friendica\Test\MockedTest;
|
use Friendica\Test\MockedTest;
|
||||||
use Friendica\Test\Util\AppMockTrait;
|
use Friendica\Test\Util\AppMockTrait;
|
||||||
use Friendica\Test\Util\VFSTrait;
|
use Friendica\Test\Util\VFSTrait;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
|
|
||||||
class BBCodeTest extends MockedTest
|
class BBCodeTest extends MockedTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Friendica\Test\src\Util;
|
namespace Friendica\Test\src\Util;
|
||||||
|
|
||||||
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\Core\Config\Configuration;
|
use Friendica\Core\Config\Configuration;
|
||||||
use Friendica\Test\MockedTest;
|
use Friendica\Test\MockedTest;
|
||||||
use Friendica\Util\BaseURL;
|
|
||||||
|
|
||||||
class BaseURLTest extends MockedTest
|
class BaseURLTest extends MockedTest
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue