X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=137e0adb563218b312b51fc3b0dc021899df677f;hb=41663c7592abe55a958632c3a48265e0a8544d2b;hp=31b026f8995a40536a99dad17033be5e7898d6d0;hpb=dbc6eb5422b81c95d6e1eea63c8ace794ccd2039;p=friendica.git
diff --git a/mod/photos.php b/mod/photos.php
index 31b026f899..137e0adb56 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -153,7 +153,7 @@ function photos_post(App $a)
$visitor = 0;
$page_owner_uid = $a->data['user']['uid'];
- $community_page = $a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY;
+ $community_page = $a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
if (local_user() && (local_user() == $page_owner_uid)) {
$can_post = true;
@@ -409,9 +409,12 @@ function photos_post(App $a)
}
}
- $photo = Photo::getPhotoForUser($page_owner_uid, $resource_id);
+ $photos_stmt = DBA::select('photo', [], ['resource-id' => $resource_id, 'uid' => $page_owner_uid], ['order' => ['scale' => true]]);
- if (DBA::isResult($photo)) {
+ $photos = DBA::toArray($photos_stmt);
+
+ if (DBA::isResult($photos)) {
+ $photo = $photos[0];
$ext = $phototypes[$photo['type']];
Photo::update(
['desc' => $desc, 'album' => $albname, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow, 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny],
@@ -422,16 +425,15 @@ function photos_post(App $a)
if ($albname !== $origaname) {
Photo::clearAlbumCache($page_owner_uid);
}
- }
+ /* Don't make the item visible if the only change was the album name */
- /* Don't make the item visible if the only change was the album name */
-
- $visibility = 0;
- if ($photo['desc'] !== $desc || strlen($rawtags)) {
- $visibility = 1;
+ $visibility = 0;
+ if ($photo['desc'] !== $desc || strlen($rawtags)) {
+ $visibility = 1;
+ }
}
- if (!$item_id) {
+ if (DBA::isResult($photos) && !$item_id) {
// Create item container
$title = '';
$uri = Item::newURI($page_owner_uid);
@@ -527,7 +529,7 @@ function photos_post(App $a)
if ($tagcid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($tagcid),
- intval($profile_uid)
+ intval($page_owner_uid)
);
} else {
$newname = str_replace('_',' ',$name);
@@ -598,7 +600,7 @@ function photos_post(App $a)
Item::update($fields, $condition);
$best = 0;
- foreach ($p as $scales) {
+ foreach ($photos as $scales) {
if (intval($scales['scale']) == 2) {
$best = 2;
break;
@@ -646,13 +648,13 @@ function photos_post(App $a)
$arr['object'] = '' . "\n";
$arr['target'] = '' . ACTIVITY_OBJ_IMAGE . '' . $photo['desc'] . ''
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '';
- $arr['target'] .= '' . XML::escape('' . "\n" . '') . '';
+ $arr['target'] .= '' . XML::escape('' . "\n" . '') . '';
Item::insert($arr);
}
@@ -938,7 +940,7 @@ function photos_content(App $a)
$owner_uid = $a->data['user']['uid'];
- $community_page = (($a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
+ $community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
if (local_user() && (local_user() == $owner_uid)) {
$can_post = true;
@@ -1562,7 +1564,7 @@ function photos_content(App $a)
}
$response_verbs = ['like'];
$response_verbs[] = 'dislike';
- $responses = get_responses($conv_responses, $response_verbs, '', $link_item);
+ $responses = get_responses($conv_responses, $response_verbs, $link_item);
$paginate = $pager->renderFull($total);
}