]> git.mxchange.org Git - friendica.git/blobdiff - mod/photo.php
Merge pull request #6137 from Alkarex/WebSub_fixes
[friendica.git] / mod / photo.php
index c8e2fc87d28957f50db616cd03a492735e48e70c..54418f730d09e1789208dd78447bb9d0376359c6 100644 (file)
@@ -6,8 +6,7 @@
 use Friendica\App;
 use Friendica\Database\DBA;
 use Friendica\Object\Image;
-
-require_once 'include/security.php';
+use Friendica\Util\Security;
 
 function photo_init(App $a)
 {
@@ -52,7 +51,7 @@ function photo_init(App $a)
                exit;
        }
 
-       $default = 'images/person-175.jpg';
+       $default = 'images/person-300.jpg';
        $public = true;
 
        if (isset($type)) {
@@ -83,7 +82,7 @@ function photo_init(App $a)
                        intval($resolution),
                        intval($uid)
                );
-               if (DBA::is_result($r)) {
+               if (DBA::isResult($r)) {
                        $data = $r[0]['data'];
                        $mimetype = $r[0]['type'];
                }
@@ -107,18 +106,18 @@ function photo_init(App $a)
 
                // check if the photo exists and get the owner of the photo
                $r = q("SELECT `uid` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1",
-                       dbesc($photo),
+                       DBA::escape($photo),
                        intval($resolution)
                );
-               if (DBA::is_result($r)) {
-                       $sql_extra = permissions_sql($r[0]['uid']);
+               if (DBA::isResult($r)) {
+                       $sql_extra = Security::getPermissionsSQLByUserId($r[0]['uid']);
 
                        // Now we'll see if we can access the photo
                        $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` <= %d $sql_extra ORDER BY scale DESC LIMIT 1",
-                               dbesc($photo),
+                               DBA::escape($photo),
                                intval($resolution)
                        );
-                       if (DBA::is_result($r)) {
+                       if (DBA::isResult($r)) {
                                $resolution = $r[0]['scale'];
                                $data = $r[0]['data'];
                                $mimetype = $r[0]['type'];
@@ -138,7 +137,7 @@ function photo_init(App $a)
                if (isset($resolution)) {
                        switch ($resolution) {
                                case 4:
-                                       $data = file_get_contents('images/person-175.jpg');
+                                       $data = file_get_contents('images/person-300.jpg');
                                        $mimetype = 'image/jpeg';
                                        break;
                                case 5:
@@ -192,7 +191,7 @@ function photo_init(App $a)
        // If the photo is public and there is an existing photo directory store the photo there
        if ($public and $file != '') {
                // If the photo path isn't there, try to create it
-               $basepath = $a->get_basepath();
+               $basepath = $a->getBasePath();
                if (!is_dir($basepath . "/photo")) {
                        if (is_writable($basepath)) {
                                mkdir($basepath . "/photo");