]> git.mxchange.org Git - friendica.git/blobdiff - src/App/Mode.php
Remove unused cached avatar photo entries
[friendica.git] / src / App / Mode.php
index cc18373e9eff0703c35f446d18012297f4b53594..e19de8f07f4feaba6555f4f6b9394ee37ef9b7f8 100644 (file)
@@ -38,6 +38,9 @@ class Mode
        const DBCONFIGAVAILABLE   = 4;
        const MAINTENANCEDISABLED = 8;
 
+       const BACKEND_CONTENT_TYPES = ['application/jrd+json', 'text/xml',
+               'application/rss+xml', 'application/atom+xml', 'application/activity+json'];
+
        /***
         * @var int The mode of this Application
         *
@@ -134,8 +137,13 @@ class Mode
         */
        public function determineRunMode(bool $isBackend, Module $module, array $server, MobileDetect $mobileDetect)
        {
-               $isBackend = $isBackend ||
-                            $module->isBackend();
+               foreach (self::BACKEND_CONTENT_TYPES as $type) {
+                       if (strpos(strtolower($server['HTTP_ACCEPT'] ?? ''), $type) !== false) {
+                               $isBackend = true;
+                       }
+               }
+
+               $isBackend = $isBackend || $module->isBackend();
                $isMobile  = $mobileDetect->isMobile();
                $isTablet  = $mobileDetect->isTablet();
                $isAjax    = strtolower($server['HTTP_X_REQUESTED_WITH'] ?? '') == 'xmlhttprequest';