]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Make frio more consistent by replacing textual links with icons everywhere. (#5415)
[friendica.git] / mod / photos.php
index f54bc62444263252a1f7e55acd8696dd382d7afa..07916c5871b4cf61aa0d55d81c8e4a838c434589 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
@@ -101,6 +102,8 @@ function photos_init(App $a) {
 
                if (local_user() && $a->data['user']['uid'] == local_user()) {
                        $can_post = true;
+               } else {
+                       $can_post = false;
                }
 
                if ($ret['success']) {
@@ -218,7 +221,7 @@ function photos_post(App $a)
                        // Update the photo albums cache
                        Photo::clearAlbumCache($page_owner_uid);
 
-                       $newurl = str_replace(bin2hex($album), bin2hex($newalbum), $_SESSION['photo_return']);
+                       $newurl = System::baseUrl() . '/photos/' . $a->user['nickname'] . '/album/' . bin2hex($newalbum);
                        goaway($newurl);
                        return; // NOTREACHED
                }
@@ -453,11 +456,11 @@ function photos_post(App $a)
                        $uri = Item::newURI($page_owner_uid);
 
                        $arr = [];
-                       $arr['guid']          = get_guid(32);
+                       $arr['guid']          = System::createGUID(32);
                        $arr['uid']           = $page_owner_uid;
                        $arr['uri']           = $uri;
                        $arr['parent-uri']    = $uri;
-                       $arr['type']          = 'photo';
+                       $arr['post-type']     = Item::PT_IMAGE;
                        $arr['wall']          = 1;
                        $arr['resource-id']   = $p[0]['resource-id'];
                        $arr['contact-id']    = $owner_record['id'];
@@ -620,11 +623,10 @@ function photos_post(App $a)
                                        $uri = Item::newURI($page_owner_uid);
 
                                        $arr = [];
-                                       $arr['guid']          = get_guid(32);
+                                       $arr['guid']          = System::createGUID(32);
                                        $arr['uid']           = $page_owner_uid;
                                        $arr['uri']           = $uri;
                                        $arr['parent-uri']    = $uri;
-                                       $arr['type']          = 'activity';
                                        $arr['wall']          = 1;
                                        $arr['contact-id']    = $owner_record['id'];
                                        $arr['owner-name']    = $owner_record['name'];
@@ -640,6 +642,7 @@ function photos_post(App $a)
                                        $arr['deny_gid']      = $p[0]['deny_gid'];
                                        $arr['visible']       = 1;
                                        $arr['verb']          = ACTIVITY_TAG;
+                                       $arr['gravity']       = GRAVITY_PARENT;
                                        $arr['object-type']   = ACTIVITY_OBJ_PERSON;
                                        $arr['target-type']   = ACTIVITY_OBJ_IMAGE;
                                        $arr['tag']           = $tagged[4];
@@ -855,7 +858,7 @@ function photos_post(App $a)
                $arr['coord'] = $lat . ' ' . $lon;
        }
 
-       $arr['guid']          = get_guid(32);
+       $arr['guid']          = System::createGUID(32);
        $arr['uid']           = $page_owner_uid;
        $arr['uri']           = $uri;
        $arr['parent-uri']    = $uri;
@@ -949,6 +952,7 @@ function photos_content(App $a)
        $contact        = null;
        $remote_contact = false;
        $contact_id     = 0;
+       $edit           = false;
 
        $owner_uid = $a->data['user']['uid'];
 
@@ -1037,7 +1041,7 @@ function photos_content(App $a)
 
                $albumselect = '';
 
-               $albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
+               $albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '>&lt;current year&gt;</option>';
                if (count($a->data['albums'])) {
                        foreach ($a->data['albums'] as $album) {
                                if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === L10n::t('Contact Photos'))) {
@@ -1073,7 +1077,7 @@ function photos_content(App $a)
                        '$usage' => $usage_message,
                        '$nickname' => $a->data['user']['nickname'],
                        '$newalbum' => L10n::t('New album name: '),
-                       '$existalbumtext' => L10n::t('or existing album name: '),
+                       '$existalbumtext' => L10n::t('or select existing album:'),
                        '$nosharetext' => L10n::t('Do not show a status post for this upload'),
                        '$albumselect' => $albumselect,
                        '$permissions' => L10n::t('Permissions'),
@@ -1150,9 +1154,9 @@ function photos_content(App $a)
                }
 
                if ($order_field === 'posted') {
-                       $order =  [L10n::t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)];
+                       $order =  [L10n::t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album), 'oldest'];
                } else {
-                       $order = [L10n::t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted'];
+                       $order = [L10n::t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted', 'newest'];
                }
 
                $photos = [];
@@ -1346,7 +1350,7 @@ function photos_content(App $a)
                        $link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
 
                        $condition = ["`parent` = ? AND `parent` != `id`",  $link_item['parent']];
-                       $a->set_pager_total(dba::count('item', $condition));
+                       $a->set_pager_total(DBA::count('item', $condition));
 
                        $params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
                        $result = Item::selectForUser($link_item['uid'], [], $condition, $params);
@@ -1442,7 +1446,6 @@ function photos_content(App $a)
                                        $comments .= replace_macros($cmnt_tpl, [
                                                '$return_path' => '',
                                                '$jsreload' => $return_url,
-                                               '$type' => 'wall-comment',
                                                '$id' => $link_item['id'],
                                                '$parent' => $link_item['id'],
                                                '$profile_uid' =>  $owner_uid,
@@ -1481,7 +1484,6 @@ function photos_content(App $a)
                                        $comments .= replace_macros($cmnt_tpl,[
                                                '$return_path' => '',
                                                '$jsreload' => $return_url,
-                                               '$type' => 'wall-comment',
                                                '$id' => $link_item['id'],
                                                '$parent' => $link_item['id'],
                                                '$profile_uid' =>  $owner_uid,
@@ -1542,7 +1544,6 @@ function photos_content(App $a)
                                                $comments .= replace_macros($cmnt_tpl, [
                                                        '$return_path' => '',
                                                        '$jsreload' => $return_url,
-                                                       '$type' => 'wall-comment',
                                                        '$id' => $item['item_id'],
                                                        '$parent' => $item['parent'],
                                                        '$profile_uid' =>  $owner_uid,