]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Documentation
[friendica.git] / src / Model / Photo.php
index 5400cafb40394be2d35708c8ad1cf7d4e411e68e..a9b4c0fb736fd139957518921de46f03cac308d5 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Database\DBA;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\Util\Security;
 
 require_once 'include/dba.php';
 
@@ -114,7 +115,7 @@ class Photo
                $type = Image::guessType($image_url, true);
                $Image = new Image($img_str, $type);
                if ($Image->isValid()) {
-                       $Image->scaleToSquare(175);
+                       $Image->scaleToSquare(300);
 
                        $r = self::store($Image, $uid, $cid, $hash, $filename, 'Contact Photos', 4);
 
@@ -146,7 +147,7 @@ class Photo
 
                        // Remove the cached photo
                        $a = get_app();
-                       $basepath = $a->get_basepath();
+                       $basepath = $a->getBasePath();
 
                        if (is_dir($basepath . "/photo")) {
                                $filename = $basepath . '/photo/' . $hash . '-4.' . $Image->getExt();
@@ -171,7 +172,7 @@ class Photo
                }
 
                if ($photo_failure) {
-                       $image_url = System::baseUrl() . '/images/person-175.jpg';
+                       $image_url = System::baseUrl() . '/images/person-300.jpg';
                        $thumb = System::baseUrl() . '/images/person-80.jpg';
                        $micro = System::baseUrl() . '/images/person-48.jpg';
                }
@@ -226,7 +227,7 @@ class Photo
         */
        public static function getAlbums($uid, $update = false)
        {
-               $sql_extra = permissions_sql($uid);
+               $sql_extra = Security::getPermissionsSQLByUserId($uid);
 
                $key = "photo_albums:".$uid.":".local_user().":".remote_user();
                $albums = Cache::get($key);
@@ -239,8 +240,8 @@ class Photo
                                        WHERE `uid` = %d  AND `album` != '%s' AND `album` != '%s' $sql_extra
                                        GROUP BY `album` ORDER BY `created` DESC",
                                        intval($uid),
-                                       dbesc('Contact Photos'),
-                                       dbesc(L10n::t('Contact Photos'))
+                                       DBA::escape('Contact Photos'),
+                                       DBA::escape(L10n::t('Contact Photos'))
                                );
                        } else {
                                // This query doesn't do the count and is much faster
@@ -248,11 +249,11 @@ class Photo
                                        FROM `photo` USE INDEX (`uid_album_scale_created`)
                                        WHERE `uid` = %d  AND `album` != '%s' AND `album` != '%s' $sql_extra",
                                        intval($uid),
-                                       dbesc('Contact Photos'),
-                                       dbesc(L10n::t('Contact Photos'))
+                                       DBA::escape('Contact Photos'),
+                                       DBA::escape(L10n::t('Contact Photos'))
                                );
                        }
-                       Cache::set($key, $albums, CACHE_DAY);
+                       Cache::set($key, $albums, Cache::DAY);
                }
                return $albums;
        }
@@ -264,7 +265,7 @@ class Photo
        public static function clearAlbumCache($uid)
        {
                $key = "photo_albums:".$uid.":".local_user().":".remote_user();
-               Cache::set($key, null, CACHE_DAY);
+               Cache::set($key, null, Cache::DAY);
        }
 
        /**