]> git.mxchange.org Git - friendica.git/blobdiff - index.php
AP: Announce will now work
[friendica.git] / index.php
index bccdebe7b05f65ab9f0999343d7355b4382bfc7a..6ab405c632a3f092db5914db9f146f6f457b7ab1 100644 (file)
--- a/index.php
+++ b/index.php
@@ -23,11 +23,9 @@ use Friendica\Module\Login;
 
 require_once 'boot.php';
 
-$a = new App(__DIR__);
-
 // We assume that the index.php is called by a frontend process
 // The value is set to "true" by default in boot.php
-$a->backend = false;
+$a = new App(__DIR__, false);
 
 /**
  * Try to open the database;
@@ -36,7 +34,7 @@ $a->backend = false;
 require_once "include/dba.php";
 
 // Missing DB connection: ERROR
-if ($a->mode & App::MODE_LOCALCONFIGPRESENT && !($a->mode & App::MODE_DBAVAILABLE)) {
+if ($a->getMode()->has(App\Mode::LOCALCONFIGPRESENT) && !$a->getMode()->has(App\Mode::DBAVAILABLE)) {
        System::httpExit(500, ['title' => 'Error 500 - Internal Server Error', 'description' => 'Apologies but the website is unavailable at the moment.']);
 }
 
@@ -48,8 +46,12 @@ if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
        System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']);
 }
 
-if (!$a->isInstallMode()) {
-       if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
+if (strstr($a->query_string, '.well-known/host-meta') && ($a->query_string != '.well-known/host-meta')) {
+       System::httpExit(404);
+}
+
+if (!$a->getMode()->isInstall()) {
+       if (Config::get('system', 'force_ssl') && ($a->getScheme() == "http")
                && (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
                && (substr(System::baseUrl(), 0, 8) == "https://")
                && ($_SERVER['REQUEST_METHOD'] == 'GET')) {
@@ -78,10 +80,10 @@ L10n::loadTranslationTable($lang);
  */
 
 // Exclude the backend processes from the session management
-if (!$a->is_backend()) {
+if (!$a->isBackend()) {
        $stamp1 = microtime(true);
        session_start();
-       $a->save_timestamp($stamp1, "parser");
+       $a->saveTimestamp($stamp1, "parser");
 } else {
        $_SESSION = [];
        Worker::executeIfIdle();
@@ -107,7 +109,7 @@ if (!empty($_SESSION['language']) && $_SESSION['language'] !== $lang) {
        L10n::loadTranslationTable($lang);
 }
 
-if (!empty($_GET['zrl']) && $a->mode == App::MODE_NORMAL) {
+if (!empty($_GET['zrl']) && $a->getMode()->isNormal()) {
        $a->query_string = Profile::stripZrls($a->query_string);
        if (!local_user()) {
                // Only continue when the given profile link seems valid
@@ -130,7 +132,7 @@ if (!empty($_GET['zrl']) && $a->mode == App::MODE_NORMAL) {
        }
 }
 
-if (!empty($_GET['owt']) && $a->mode == App::MODE_NORMAL) {
+if (!empty($_GET['owt']) && $a->getMode()->isNormal()) {
        $token = $_GET['owt'];
        $a->query_string = Profile::stripQueryParam($a->query_string, 'owt');
        Profile::openWebAuthInit($token);
@@ -165,14 +167,14 @@ $_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
 
 // in install mode, any url loads install module
 // but we need "view" module for stylesheet
-if ($a->isInstallMode() && $a->module!="view") {
+if ($a->getMode()->isInstall() && $a->module != 'view') {
        $a->module = 'install';
-} elseif (!($a->mode & App::MODE_MAINTENANCEDISABLED) && $a->module != "view") {
+} elseif (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $a->module != 'view') {
        $a->module = 'maintenance';
 } else {
        check_url($a);
        check_db(false);
-       check_addons($a);
+       Addon::check();
 }
 
 Nav::setSelected('nothing');
@@ -320,7 +322,7 @@ if (file_exists($theme_info_file)) {
 
 /* initialise content region */
 
-if ($a->mode == App::MODE_NORMAL) {
+if ($a->getMode()->isNormal()) {
        Addon::callHooks('page_content_top', $a->page['content']);
 }