]> git.mxchange.org Git - friendica.git/commitdiff
show permission denied photo when direct link was accessed and authentication is...
authorFriendika <info@friendika.com>
Thu, 10 Mar 2011 05:29:32 +0000 (21:29 -0800)
committerFriendika <info@friendika.com>
Thu, 10 Mar 2011 05:29:32 +0000 (21:29 -0800)
images/nosign.jpg [new file with mode: 0644]
mod/photo.php

diff --git a/images/nosign.jpg b/images/nosign.jpg
new file mode 100644 (file)
index 0000000..b736293
Binary files /dev/null and b/images/nosign.jpg differ
index 7f13d1cbf83db67d765ccf3d6c527f2b81bd9c1c..2f8d180fdb9c60c1824bb84858d3068515f0ecda 100644 (file)
@@ -108,6 +108,24 @@ function photo_init(&$a) {
                        if(count($r)) {
                                $data = $r[0]['data'];
                        }
+                       else {
+
+                               // Does the picture exist? It may be a remote person with no credentials,
+                               // but who should otherwise be able to view it. Show a default image to let 
+                               // them know permissions was denied. It may be possible to view the image 
+                               // through an authenticated profile visit.
+                               // There won't be many complete unauthorised people seeing this because
+                               // they won't have the photo link, so there's a reasonable chance that the person
+                               // might be able to obtain permission to view it.
+                               $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d LIMIT 1",
+                                       dbesc($photo),
+                                       intval($resolution)
+                               );
+                               if(count($r)) {
+                                       $data = file_get_contents('images/nosign.jpg');
+                               }
+                       }
                }
        }