]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #8179 from MrPetovan/bug/notices
authorPhilipp <admin+Github@philipp.info>
Sun, 26 Jan 2020 22:10:56 +0000 (23:10 +0100)
committerGitHub <noreply@github.com>
Sun, 26 Jan 2020 22:10:56 +0000 (23:10 +0100)
Various notice fixes

include/api.php
mod/display.php

index f43ee2d1bae693903319081120d9e0aeee31f3f8..a69bd01b4971edfcea66cb166a3542111c3cd931 100644 (file)
@@ -312,9 +312,7 @@ function api_call(App $a, App\Arguments $args = null)
                                }
 
                                $called_api = explode("/", $p);
-                               //unset($_SERVER['PHP_AUTH_USER']);
 
-                               /// @TODO should be "true ==[=] $info['auth']", if you miss only one = character, you assign a variable (only with ==). Let's make all this even.
                                if (!empty($info['auth']) && api_user() === false) {
                                        api_login($a);
                                }
@@ -5028,6 +5026,9 @@ function prepare_photo_data($type, $scale, $photo_id)
        // retrieve item element for getting activities (like, dislike etc.) related to photo
        $condition = ['uid' => local_user(), 'resource-id' => $photo_id, 'type' => 'photo'];
        $item = Item::selectFirstForUser(local_user(), ['id'], $condition);
+       if (!DBA::isResult($item)) {
+               throw new NotFoundException('Photo-related item not found.');
+       }
 
        $data['photo']['friendica_activities'] = api_format_items_activities($item, $type);
 
index 8be5520138199719fd682c996808608c8dd9f041..582bcde28e040f0bfddf49f2c8ca4c6f5b09d1bd 100644 (file)
@@ -96,10 +96,10 @@ function display_init(App $a)
 
        $profiledata = display_fetchauthor($a, $item);
 
-       if (strstr(Strings::normaliseLink($profiledata["url"]), Strings::normaliseLink(DI::baseUrl()))) {
-               $nickname = str_replace(Strings::normaliseLink(DI::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"]));
+       if (strstr(Strings::normaliseLink($profiledata['url']), Strings::normaliseLink(DI::baseUrl()))) {
+               $nickname = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/profile/', '', Strings::normaliseLink($profiledata['url']));
 
-               if ($nickname != $a->user["nickname"]) {
+               if (!empty($a->user['nickname']) && $nickname != $a->user['nickname']) {
                        $profile = DBA::fetchFirst("SELECT `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
                                INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
                                WHERE `user`.`nickname` = ? AND `contact`.`self` LIMIT 1",