use Friendica\Core\Config\Configuration;
use Friendica\Core\Hook;
use Friendica\Core\Theme;
+use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\Model\Profile;
use Friendica\Network\HTTPException;
*/
private $profiler;
+ /**
+ * @var Database The Friendica database connection
+ */
+ private $database;
+
/**
* Returns the current config cache of this node
*
*/
public function getBasePath()
{
- return $this->config->get('system', 'basepath');
+ // Don't use the basepath of the config table for basepath (it should always be the config-file one)
+ return $this->config->getCache()->get('system', 'basepath');
}
/**
return $this->router;
}
+ /**
+ * @return Database
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
/**
* Register a stylesheet file path to be included in the <head> tag of every page.
* Inclusion is done in App->initHead().
/**
* @brief App constructor.
*
+ * @param Database $database The Friendica Database
* @param Configuration $config The Configuration
* @param App\Mode $mode The mode of this Friendica app
* @param App\Router $router The router of this Friendica app
*
* @throws Exception if the Basepath is not usable
*/
- public function __construct(Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
+ public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
{
BaseObject::setApp($this);
+ $this->database = $database;
$this->config = $config;
$this->mode = $mode;
$this->router = $router;
header('Refresh: 120; url=' . $this->getBaseURL() . "/" . $this->query_string);
Module\Special\HTTPException::rawContent(
- new HTTPException\ServiceUnavaiableException('The node is currently overloaded. Please try again later.')
- );
- }
-
- if (strstr($this->query_string, '.well-known/host-meta') && ($this->query_string != '.well-known/host-meta')) {
- Module\Special\HTTPException::rawContent(
- new HTTPException\NotFoundException()
+ new HTTPException\ServiceUnavailableException('The node is currently overloaded. Please try again later.')
);
}
// Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") &&
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
- if (defaults($_SESSION, "visitor_home", "") != $_GET["zrl"]) {
- $_SESSION['my_url'] = $_GET['zrl'];
- $_SESSION['authenticated'] = 0;
+ if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
+ Core\Session::set('my_url', $_GET['zrl']);
+ Core\Session::set('authenticated', 0);
}
+
Model\Profile::zrlInit($this);
} else {
// Someone came with an invalid parameter, maybe as a DDoS attempt
header('X-Account-Management-Status: none');
}
- $_SESSION['sysmsg'] = defaults($_SESSION, 'sysmsg' , []);
- $_SESSION['sysmsg_info'] = defaults($_SESSION, 'sysmsg_info' , []);
- $_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
+ $_SESSION['sysmsg'] = Core\Session::get('sysmsg', []);
+ $_SESSION['sysmsg_info'] = Core\Session::get('sysmsg_info', []);
+ $_SESSION['last_updated'] = Core\Session::get('last_updated', []);
/*
* check_config() is responsible for running update scripts. These automatically
// in install mode, any url loads install module
// but we need "view" module for stylesheet
- if ($this->getMode()->isInstall() && $this->module != 'view') {
- $this->module = 'install';
- } elseif (!$this->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $this->module != 'view') {
- $this->module = 'maintenance';
+ if ($this->getMode()->isInstall() && $this->module !== 'install') {
+ $this->internalRedirect('install');
+ } elseif (!$this->getMode()->isInstall() && !$this->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $this->module !== 'maintenance') {
+ $this->internalRedirect('maintenance');
} else {
$this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->getMode());
// Compatibility with the Android Diaspora client
if ($this->module == 'stream') {
- $this->internalRedirect('network?f=&order=post');
+ $this->internalRedirect('network?order=post');
}
if ($this->module == 'conversations') {
}
if ($this->module == 'commented') {
- $this->internalRedirect('network?f=&order=comment');
+ $this->internalRedirect('network?order=comment');
}
if ($this->module == 'liked') {
- $this->internalRedirect('network?f=&order=comment');
+ $this->internalRedirect('network?order=comment');
}
if ($this->module == 'activity') {
- $this->internalRedirect('network/?f=&conv=1');
+ $this->internalRedirect('network?conv=1');
}
if (($this->module == 'status_messages') && ($this->cmd == 'status_messages/new')) {