]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Merge pull request #12029 from annando/warning
[friendica.git] / mod / display.php
index bc667dd5e122750a6c429683eda2144008f745c6..c1b7746e24c5ee3d655af158d05a723b91be8c35 100644 (file)
@@ -102,11 +102,11 @@ function display_init(App $a)
        }
 
        if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
-               Logger::info('Directly serving XML for uri-id '.$item['uri-id']);
+               Logger::debug('Directly serving XML', ['uri-id' => $item['uri-id']]);
                displayShowFeed($item['uri-id'], $item['uid'], false);
        }
 
-       if ($item['gravity'] != GRAVITY_PARENT) {
+       if ($item['gravity'] != Item::GRAVITY_PARENT) {
                $parent = Post::selectFirstForUser($item_user, $fields, ['uid' => [0, $item_user], 'uri-id' => $item['parent-uri-id']], ['order' => ['uid' => true]]);
                $item = $parent ?: $item;
        }
@@ -160,15 +160,19 @@ function display_content(App $a, $update = false, $update_uid = 0)
                        }
                        $parent_uri_id = $item['parent-uri-id'];
                }
-               $browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
-               if (!empty($browser_update)) {
-                       $update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
-                       if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
-                               Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
-                               return '';
-                       } else {
-                               Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
-                       }
+               if (empty($_REQUEST['force'])) {
+                       $browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
+                       if (!empty($browser_update)) {
+                               $update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
+                               if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
+                                       Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
+                                       return '';
+                               } else {
+                                       Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
+                               }
+                       }       
+               } else {
+                       Logger::debug('Forced content update', ['uri-id' => $uri_id, 'uid' => $update_uid]);
                }
        } else {
                $uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);
@@ -298,7 +302,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
 
        // Preparing the meta header
        $description = trim(BBCode::toPlaintext($item['body']));
-       $title = trim(BBCode::toPlaintext($item['title']));
+       $title = trim(BBCode::toPlaintext($item['title'] ?? ''));
        $author_name = $item['author-name'];
 
        $image = DI::baseUrl()->remove($item['author-avatar']);