<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Exception;
use Friendica\App\Arguments;
use Friendica\App\BaseURL;
+use Friendica\App\Module;
+use Friendica\Module\Maintenance;
use Friendica\Security\Authentication;
use Friendica\Core\Config\Cache;
use Friendica\Core\Config\IConfig;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Database\Database;
+use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException;
public $sourcename = '';
public $videowidth = 425;
public $videoheight = 350;
- public $force_max_items = 0;
public $theme_events_in_profile = true;
public $queue;
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public function runFrontend(App\Module $module, App\Router $router, IPConfig $pconfig, Authentication $auth, App\Page $page)
+ public function runFrontend(App\Module $module, App\Router $router, IPConfig $pconfig, Authentication $auth, App\Page $page, float $start_time)
{
+ $this->profiler->set($start_time, 'start');
+ $this->profiler->set(microtime(true), 'classinit');
+
$moduleName = $module->getName();
try {
Core\Hook::callAll('init_1');
}
- // Exclude the backend processes from the session management
- if ($this->mode->isBackend()) {
- Core\Worker::executeIfIdle();
- }
-
if ($this->mode->isNormal() && !$this->mode->isBackend()) {
$requester = HTTPSignature::getSigner('', $_SERVER);
if (!empty($requester)) {
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
Core\Session::set('my_url', $_GET['zrl']);
Core\Session::set('authenticated', 0);
+
+ $remote_contact = Contact::getByURL($_GET['zrl'], false, ['subscribe']);
+ if (!empty($remote_contact['subscribe'])) {
+ $_SESSION['remote_comment'] = $remote_contact['subscribe'];
+ }
}
Model\Profile::zrlInit($this);
// but we need "view" module for stylesheet
if ($this->mode->isInstall() && $moduleName !== 'install') {
$this->baseURL->redirect('install');
- } elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
- $this->baseURL->redirect('maintenance');
} else {
$this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->mode);
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
$page['page_title'] = $moduleName;
- // determine the module class and save it to the module instance
- // @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
- $module = $module->determineClass($this->args, $router, $this->config);
+ if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
+ $module = new Module('maintenance', Maintenance::class);
+ } else {
+ // determine the module class and save it to the module instance
+ // @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
+ $module = $module->determineClass($this->args, $router, $this->config);
+ }
// Let the module run it's internal process (init, get, post, ...)
- $module->run($this->l10n, $this->baseURL, $this->logger, $_SERVER, $_POST);
+ $module->run($this->l10n, $this->baseURL, $this->logger, $this->profiler, $_SERVER, $_POST);
} catch (HTTPException $e) {
ModuleHTTPException::rawContent($e);
}
- $page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig);
+ $page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->profiler, $this->config, $pconfig);
}
/**